Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
- Subject: Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
- From: Jens Alfke <email@hidden>
- Date: Fri, 05 Sep 2014 14:10:59 -0700
> On Sep 5, 2014, at 1:48 PM, Quincey Morris <email@hidden> wrote:
>
> It seems to me you’re *still* abusing the main thread. A dispatch_sync blocks the main thread, so it can’t be allowed to do anything that run asynchronously on the main thread (such as displaying a dialog) since that won’t complete.
Why not? I assume Jonathan's -shouldIAccept: is running a nested event loop for the modal panel, since it doesn't return till the user dismisses it.
(Whether it's a dispatch_sync or a dispatch_async doesn't matter; the main thread will be blocked for as long as the block takes to run.)
I still think the problem is that you're blocking the dispatch-queue's thread for a long time. Try pausing the app while the dialog is up and looking at what the various threads are doing.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden