FROM : Nick Zitzmann
DATE : Sun Dec 12 18:48:23 2004
On Dec 12, 2004, at 8:36 AM, Jeremy Dronfield wrote:
> 1. How do locks work?
Locks work by making it so that if a -lock message is sent to a lock
that is already locked, then the thread will freeze until whatever
obtained the lock in the first place unlocks the lock. Then the other
thread will unfreeze and it will obtain the lock, and anything else
that attempts to acquire the lock will freeze until the lock is
unlocked, and so on...
> 2. It appears that NSLock can't be used with non-object variables.
> Some of my search criteria are strings, but most are BOOLs and ints.
> How can I lock those?
You can put _anything_ under the protection of an NSLock, not just
Foundation objects.
Nick Zitzmann
<http://www.chronosnet.com/>
DATE : Sun Dec 12 18:48:23 2004
On Dec 12, 2004, at 8:36 AM, Jeremy Dronfield wrote:
> 1. How do locks work?
Locks work by making it so that if a -lock message is sent to a lock
that is already locked, then the thread will freeze until whatever
obtained the lock in the first place unlocks the lock. Then the other
thread will unfreeze and it will obtain the lock, and anything else
that attempts to acquire the lock will freeze until the lock is
unlocked, and so on...
> 2. It appears that NSLock can't be used with non-object variables.
> Some of my search criteria are strings, but most are BOOLs and ints.
> How can I lock those?
You can put _anything_ under the protection of an NSLock, not just
Foundation objects.
Nick Zitzmann
<http://www.chronosnet.com/>
| Related mails | Author | Date |
|---|---|---|
| Jeremy Dronfield | Dec 12, 16:36 | |
| Nick Zitzmann | Dec 12, 18:48 | |
| Clark Cox | Dec 13, 04:34 | |
| Evan Schoenberg | Dec 13, 05:05 | |
| Andreas Mayer | Dec 13, 07:38 | |
| Jeremy Dronfield | Dec 13, 12:54 | |
| Guy English | Dec 13, 20:48 | |
| Jeremy Dronfield | Dec 13, 23:07 |






Cocoa mail archive

