• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
      • From: Roland King <email@hidden>
References: 
 >dispatch_sync(dispatch_get_main_queue() UI weirdness (From: Jonathan Guy <email@hidden>)
 >Re: dispatch_sync(dispatch_get_main_queue() UI weirdness (From: Jens Alfke <email@hidden>)
 >Re: dispatch_sync(dispatch_get_main_queue() UI weirdness (From: Jonathan Guy <email@hidden>)
 >Re: dispatch_sync(dispatch_get_main_queue() UI weirdness (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
  • Next by Date: Re: Modal sheet, full screen & swipe instability
  • Previous by thread: Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
  • Next by thread: Re: dispatch_sync(dispatch_get_main_queue() UI weirdness
  • Index(es):
    • Date
    • Thread