nslock

Should an NSLock instance be "global"?

Should I make a single NSLock instance in the application delegate, to be used by all classes? Or is it advisable to have each class instantiate its own NSLock instance as needed? Would the locking work in the second case, if I, for example, had access to a managed object context that is spread across two view controllers? ...

Multi-Threading question in Objective-C 2.0

Hi there, I have my main application delegate which contains a method that returns an object. This application delegate runs on the main thread. I also have a NSOperation that gets run on a different thread. As well as wanting to be able to call my app delegate method on my main thread sometimes, I also need to call it from my NSOperat...

How can I set a breakpoint on _NSLockError()

I am trying to debug multiple threads. *** -[NSLock lock]: deadlock (<NSLock: 0xc388ab0> '(null)') *** Break on _NSLockError() to debug. How can I debug this? ...

Cocoa thread synchronisation when using [ALAssetsLibrary enumerateGroupsWithTypes:]

I have recently, like a few people, discovered that [ALAssetsLibrary enumerateGroupsWithTypes] likes to run its blocks on another thread. What a shame that Apple didn't document that :-) In my current circumstance I need to wait for the enumeration to complete, before the main thread returns any results. I clearly need some sort of thre...