NSConditionLock

NSConditionLock Mac OS X 10.0

NSConditionLock is a class that implements the NSLocking protocol and is used to perform thread locks that are associated with specific, user-defined conditions. The idea behind NSConditionLock is that a thread can acquire a lock only if some arbitrary condition has been satisfied. See Chapter 2.

figs/cocn_1318.gif

@interface NSConditionLock : NSObject <NSLocking>
 // Initializers
   - (id)initWithCondition:(int)condition;
 // Instance Methods
   - (int)condition;
   - (BOOL)lockBeforeDate:(NSDate *)limit;
   - (void)lockWhenCondition:(int)condition;
   - (BOOL)lockWhenCondition:(int)condition beforeDate:(NSDate *)limit;
   - (BOOL)tryLock;
   - (BOOL)tryLockWhenCondition:(int)condition;
   - (void)unlockWithCondition:(int)condition;
 // Methods Implementing NSLocking
   - (void)lock;
   - (void)unlock;



    Part II: API Quick Reference
    Chapter 13. Foundation Classes