O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required