Name

NSConditionLock — Mac OS X 10.0

Synopsis

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.

image with no caption

@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;

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.