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 @@ -77,6 +77,9 @@ static int wait_for_stdin() {
7777
7878 // continuously run an event loop until the stdin_received flag is set to exit
7979 while (!stdin_received && !stdin_sigint) {
80+ // This loop is similar to the main event loop and flush_events which have
81+ // Py_[BEGIN|END]_ALLOW_THREADS surrounding the loop.
82+ // This should not be necessary here because PyOS_InputHook releases the GIL for us.
8083 while (true ) {
8184 NSEvent *event = [NSApp nextEventMatchingMask: NSEventMaskAny
8285 untilDate: [NSDate distantPast ]
@@ -380,6 +383,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
380383 // to process, breaking out of the loop when no events remain and
381384 // displaying the canvas if needed.
382385 NSEvent *event;
386+
387+ Py_BEGIN_ALLOW_THREADS
388+
383389 while (true ) {
384390 event = [NSApp nextEventMatchingMask: NSEventMaskAny
385391 untilDate: [NSDate distantPast ]
@@ -390,6 +396,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
390396 }
391397 [NSApp sendEvent: event];
392398 }
399+
400+ Py_END_ALLOW_THREADS
401+
393402 [self ->view displayIfNeeded ];
394403 Py_RETURN_NONE;
395404}
You can’t perform that action at this time.
0 commit comments