Instance Method

lockWhenCondition:beforeDate:

Attempts to acquire a lock before a specified moment in time.

Declaration

- (BOOL)lockWhenCondition:(NSInteger)condition beforeDate:(NSDate *)limit;

Parameters

condition

The condition to match on.

limit

The date by which the lock must be acquired or the attempt will time out.

Return Value

YES if the lock is acquired within the time limit, NO otherwise.

Discussion

The receiver’s condition must be equal to condition before the locking operation will succeed. This method blocks the thread’s execution until the lock can be acquired or limit is reached.

See Also

Acquiring and Releasing a Lock

- lockBeforeDate:

Attempts to acquire a lock before a specified moment in time.

- lockWhenCondition:

Attempts to acquire a lock.

- tryLock

Attempts to acquire a lock without regard to the receiver’s condition.

- tryLockWhenCondition:

Attempts to acquire a lock if the receiver’s condition is equal to the specified condition.

- unlockWithCondition:

Relinquishes the lock and sets the receiver’s condition.