Re: runOnMainQueueWithoutDeadlocking and all its evils.
Re: runOnMainQueueWithoutDeadlocking and all its evils.
- Subject: Re: runOnMainQueueWithoutDeadlocking and all its evils.
- From: Alex Zavatone <email@hidden>
- Date: Mon, 09 Nov 2015 05:49:33 -0500
- X_v_e_cd: ae74aad6dd0cf92b61b33fb667798c10
- X_v_r_cd: 153f074db49fa86044cca086dcbf557b
On Nov 7, 2015, at 5:20 PM, Mike Abdullah wrote:
> In my experience, the main issue is on OS X. If you ever display a modal window, that runs the run loop in a special mode for the duration of the window. The trouble is, that mode does not include dequeuing things from GCD’s main queue, so anything you ask to be done that way doesn’t happen. Faced with this myself, I’ve had to use performBlockOnMainThread:… instead to get the work done.
>
> Mike.
Thanks much, Mike. Before I started to replace these, I wanted to see why these were being forced to the main queue and an alternative in case there some realities I didn't forsee.
It will be quite nice to reduce the 60+ cases of use of these.
Cheers
>
>
>> On 6 Nov 2015, at 18:23, David Duncan <email@hidden> wrote:
>>
>>>
>>> On Nov 6, 2015, at 8:36 AM, Alex Zavatone <email@hidden> wrote:
>>>
>>> Bearing in mind my experience dealing with code in the past that was chock full of runOnMainQueueWithoutDeadlocking calls, I can not fathom why someone who was not updating the UI would need to use this type of approach… everywhere.
>>>
>>> Besides complete ineptitude, is there a rational reason that any one of you can think of why someone would be using this for GCD dispatches instead of just making and using their own GCD dispatch queue?
>>>
>>> Before I start destroying the universe and changing this (in a fork), I'd like to hear the words of those much smarter than I on this subject.
>>>
>>>
>>> But seriously, WHY?
>>
>> Roughly this approach reads like a lock that uses the main queue as its locking point. Without understanding what is being protected, it is hard to tell why this is being done.
>>
>> The usage of dispatch_sync() says that whomever wrote this expected to have the results available immediately. If not, then simply switching to dispatch_async() may be sufficient in many cases. Beyond that you will probably need to evaluate what work is being done in these cases.
>>
>>>
>>> Thank you.
_______________________________________________
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