> On Sep 21, 2016, at 10:13 AM, Doug Hill <cocoa...@breaqz.com> wrote: > > The symptoms you mention sound like a classic deadlock problem. That is, a > code block running on the main queue schedules another code block on the main > queue, but the original block never completes thus causing the app to hang or > the new task never runs.
Worth noting that this can only occur if both of the cross-thread dispatches are synchronous. As long as one of them is async, there will be no deadlock. This is a very good reason for preferring async dispatches! If you need to return a value back to the original thread, or just perform something after the UI update finishes, the idiom is to issue another (nested) dispatch_async at the end of the first block, dispatching back to the background thread. That nested block can then perform the response/cleanup actions. —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com