Re: Lockless thread-safe accessor using blocks: how to?
Re: Lockless thread-safe accessor using blocks: how to?
- Subject: Re: Lockless thread-safe accessor using blocks: how to?
- From: Dave Zarzycki <email@hidden>
- Date: Thu, 14 Apr 2011 10:34:26 -0700
On Apr 14, 2011, at 10:11 AM, WT wrote:
> Hi Dave,
>
> thanks for replying. I must say some of what you said went above my head. :)
>
> On Apr 14, 2011, at 2:02 PM, Dave Zarzycki wrote:
>
>>> The first is that if the method gets invoked already in the queue's automatic thread, there will be a deadlock. That's easy to fix, by wrapping the dispatch call into a function that tests queue against the currently executing queue and simply executes the block when they coincide.
>>
>> Actually, this isn't easy to fix due to X->A->B->A problems, where X is the current queue, then A, then B, and then the code deadlocks trying to dispatch_sync() against A "because it isn't the current queue".
>
> Why isn't the following deadlock-free?
Because once we subtract the layers of abstraction that your code is adding, we're left with this bug:
Attachment:
test.c
Description: Binary data
davez
_______________________________________________
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