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:51:58 -0500
On Nov 6, 2015, at 1:23 PM, David Duncan 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.
>
David, that's simply a perfect test. Thanks much for that insight. Here's hoping that it will be that simple to clean up.
Cheers
_______________________________________________
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