I need to use some kind of semaphore to protect access to the mutex zone, but I need this zone to span multiple threads. This is what I found in the documentation:
A warning. The NSLock class uses POSIX threads to implement its locking behavior. When sending an unlock message to an NSLock object, you must ensure that the message is sent from the same stream that sent the initial lock message. Unlocking the lock with another thread may result in undefined.
I remember reading that this is a way to prevent programming errors. Is this statement correct? I read the thread guide from the documentation, but I cannot find any other class to use that allows you to lock and unlock different threads. Is there any other solution in Cocoa for this? Thanks!
source share