NSCondition locked by invalid thread

96 views Asked by At

I'm attempting to create a multithreaded transition animation system, but am confused by seemingly corrupted state in an NSCondition object I'm using for synchronization. I've added some lines from my debugger below to illustrate what's happening:

po [NSThread currentThread]
<NSThread: 0x146f77a0>{name = Transition Animation, num = 4}

po _condition
<NSCondition: 0x1464dff0>{locked = YES, thread = 0xb083b000, name = nil}

p *(NSCondition*)_condition
(NSCondition) $5 = {
  NSObject = {
    isa = NSCondition
  }
_priv = 0x00000000
}

What's confusing me is the address and name given by the condvar's description since they don't match up with the name and address of the NSThread that's calling -lock on the condition. Additionally, inspecting the actual contents of the NSCondition itself isn't helpful since its _priv pointer is nil. Does anyone have any experience with this or know how to fix it?

P.S. Before people suggest that I just use GCD for concurrency: I'm using CADisplayLinks for my animation, so I need to use NSThreads since CADisplayLinks require an NSRunLoop to trigger updates.

0

There are 0 answers