File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ static int wait_for_stdin() {
8080
8181 // continuously run an event loop until the stdin_received flag is set to exit
8282 while (!stdin_received && !stdin_sigint) {
83+ // This loop is similar to the main event loop and flush_events which have
84+ // Py_[BEGIN|END]_ALLOW_THREADS surrounding the loop.
85+ // This should not be necessary here because PyOS_InputHook releases the GIL for us.
8386 while (true ) {
8487 NSEvent *event = [NSApp nextEventMatchingMask: NSEventMaskAny
8588 untilDate: [NSDate distantPast ]
@@ -383,6 +386,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
383386 // to process, breaking out of the loop when no events remain and
384387 // displaying the canvas if needed.
385388 NSEvent *event;
389+
390+ Py_BEGIN_ALLOW_THREADS
391+
386392 while (true ) {
387393 event = [NSApp nextEventMatchingMask: NSEventMaskAny
388394 untilDate: [NSDate distantPast ]
@@ -393,6 +399,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
393399 }
394400 [NSApp sendEvent: event];
395401 }
402+
403+ Py_END_ALLOW_THREADS
404+
396405 [self ->view displayIfNeeded ];
397406 Py_RETURN_NONE;
398407}
You can’t perform that action at this time.
0 commit comments