tdevdraw: avoid deadlock on pre-Mojave macOS - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 26c6b2579543e928158fa7d3c00d8b0e04ac270c
 (DIR) parent dc60de7b64948e89832f03181e6db799060036b8
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Fri,  5 Apr 2019 15:04:10 -0400
       
       devdraw: avoid deadlock on pre-Mojave macOS
       
       Diffstat:
         M src/cmd/devdraw/cocoa-screen.m      |       6 ++++++
       
       1 file changed, 6 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m
       t@@ -541,6 +541,11 @@ _flushmemscreen(Rectangle r)
                        return;
        
                rect = NSMakeRect(r.min.x, r.min.y, Dx(r), Dy(r));
       +
       +        // This can get blocked behind responding to mouse events,
       +        // which need to acquire the zlock, so let go of it during
       +        // the flush. Perhaps the waitUntilDone:YES is wrong?
       +        zunlock();
                [appdelegate
                        performSelectorOnMainThread:@selector(callflushimg:)
                        withObject:[NSValue valueWithRect:rect]
       t@@ -548,6 +553,7 @@ _flushmemscreen(Rectangle r)
                        modes:[NSArray arrayWithObjects:
                                NSRunLoopCommonModes,
                                @"waiting image", nil]];
       +        zlock();
        }
        
        static void drawimg(NSRect, uint);