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