File tree 1 file changed +9
-0
lines changed
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() {
77
77
78
78
// continuously run an event loop until the stdin_received flag is set to exit
79
79
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.
80
83
while (true ) {
81
84
NSEvent *event = [NSApp nextEventMatchingMask: NSEventMaskAny
82
85
untilDate: [NSDate distantPast ]
@@ -380,6 +383,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
380
383
// to process, breaking out of the loop when no events remain and
381
384
// displaying the canvas if needed.
382
385
NSEvent *event;
386
+
387
+ Py_BEGIN_ALLOW_THREADS
388
+
383
389
while (true ) {
384
390
event = [NSApp nextEventMatchingMask: NSEventMaskAny
385
391
untilDate: [NSDate distantPast ]
@@ -390,6 +396,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
390
396
}
391
397
[NSApp sendEvent: event];
392
398
}
399
+
400
+ Py_END_ALLOW_THREADS
401
+
393
402
[self ->view displayIfNeeded ];
394
403
Py_RETURN_NONE;
395
404
}
You can’t perform that action at this time.
0 commit comments