[Previous] [Up] [Next]

NSRecursiveLock

Authors

Adam Fedor

Version: $Revision$

Date: $Date$

NSRecursiveLock

NSRecursiveLock

Declared in: Foundation/NSLock.h

Inherits from: NSObject

Conforms to: NSLocking


See NSLock for more information about what a lock is. A recursive lock extends NSLock in that you can lock a recursive lock multiple times. Each lock must be balanced by a cooresponding unlock, and the lock is not released for another thread to aquire until the last unlock call is made (cooresponding to the fist lock message).

Instance Variables

Methods


Instances Methods

lockBeforeDate:

- (BOOL) lockBeforeDate: (NSDate*)limit;
Attempts to aquire a lock before the date limit passes. It returns YES if it can. It returns NO if it cannot (but it waits until the time limit is up before returning NO).

tryLock

- (BOOL) tryLock;
Attempts to aquire a lock, but returns NO immediately if the lock cannot be aquired. It returns YES if the lock is aquired. Can be called multiple times to make nested locks.