Re: NSConditionLock console message: "unlocked from thread which did not lock it"
Re: NSConditionLock console message: "unlocked from thread which did not lock it"
- Subject: Re: NSConditionLock console message: "unlocked from thread which did not lock it"
- From: "stephen joseph butler" <email@hidden>
- Date: Sun, 25 Nov 2007 12:23:12 -0600
On Nov 25, 2007 11:40 AM, Mark Alldritt <email@hidden> wrote:
> The message is correct: I lock the NSConditionLock from a worker thread to
> block the thread until another thread (the main thread) receives a response
> and the worker can continue on.
>
> This seems to me like a legitimate use of a lock. Can anyone explain what
> the problem here is.
It is, but it doesn't sound like you're doing it correctly. Take a
close look at the section titled Using an NSConditionLock:
<file://localhost/Developer/ADC Reference Library/documentation/Cocoa/Conceptual/Multithreading/articles/CocoaLocks.html#//apple_ref/doc/uid/20000737>
NSConditionLock is, at its core, a mutual exclusion lock. The only
difference is that it allows a thread (the consumer) to intelligently
release the lock until a condition is satisfied, at which point it
re-acquires the lock and continues. The produced still has to ACQUIRE
the lock before it can change the condition.
Make sense?
_______________________________________________
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