From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:35513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzTcu-0002j8-DR for qemu-devel@nongnu.org; Thu, 28 Feb 2019 16:54:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzTct-0002Us-Em for qemu-devel@nongnu.org; Thu, 28 Feb 2019 16:54:00 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:55567) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzTct-0002U3-5M for qemu-devel@nongnu.org; Thu, 28 Feb 2019 16:53:59 -0500 Received: by mail-wm1-x344.google.com with SMTP id q187so10728632wme.5 for ; Thu, 28 Feb 2019 13:53:58 -0800 (PST) MIME-Version: 1.0 References: <20190225102433.22401-1-peter.maydell@linaro.org> <20190225102433.22401-2-peter.maydell@linaro.org> In-Reply-To: <20190225102433.22401-2-peter.maydell@linaro.org> From: G 3 Date: Thu, 28 Feb 2019 16:53:45 -0500 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Qemu-devel] [PATCH v3 1/7] ui/cocoa: Ensure we have the iothread lock when calling into QEMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel qemu-devel , patches@linaro.org, Roman Bolshakov , BALATON Zoltan , Berkus Decker , Gerd Hoffmann , Ben Hekster On Mon, Feb 25, 2019 at 5:24 AM Peter Maydell wrote: > The Cocoa UI should run on the main thread; this is enforced > in OSX Mojave. In order to be able to run on the main thread, > we need to make sure we hold the iothread lock whenever we > call into various QEMU UI midlayer functions. > > Signed-off-by: Peter Maydell > Reviewed-by: Roman Bolshakov > Tested-by: Roman Bolshakov > Message-id: 20190214102816.3393-2-peter.maydell@linaro.org > --- > Changes since v2: add with_iothread_lock wrap to the > qmp_stop()/qmp_cont() calls > --- > ui/cocoa.m | 91 ++++++++++++++++++++++++++++++++++++++---------------- > 1 file changed, 65 insertions(+), 26 deletions(-) > > diff --git a/ui/cocoa.m b/ui/cocoa.m > index e2567d6946..f1171c4865 100644 > --- a/ui/cocoa.m > +++ b/ui/cocoa.m > @@ -129,6 +129,21 @@ > NSTextField *pauseLabel; > NSArray * supportedImageFileTypes; > > +// Utility function to run specified code block with iothread lock held > +typedef void (^CodeBlock)(void); > Please don't use blocks. It would lock Mac OS X users into having to use CLang. GCC does not support this non-standard extension. C function pointers and Objective-C's selectors could work in place of blocks. Thank you.