Skip navigation.
 
mlRe: NSConditionLock console message: "unlocked from thread which did not lock it"
FROM : stephen joseph butler
DATE : Sun Nov 25 19:23:12 2007

On Nov 25, 2007 11:40 AM, Mark Alldritt <<email_removed>> 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%20Reference%20Library/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?

Related mailsAuthorDate
mlNSConditionLock console message: "unlocked from thread which did not lock it" Mark Alldritt Nov 25, 18:40
mlRe: NSConditionLock console message: "unlocked from thread which did not lock it" stephen joseph but… Nov 25, 19:23
mlRe: NSConditionLock console message: "unlocked from thread which did not lock it" stephen joseph but… Nov 25, 19:24
mlRe: NSConditionLock console message: "unlocked from thread which did not lock it" Scott Ribe Nov 25, 19:26
mlRe: NSConditionLock console message: "unlocked from thread which did not lock it" Chris Kane Nov 27, 22:32