Up

NSLock class reference

Authors

Scott Christley (scottc@net-community.com)
Richard Frith-Macdonald (rfm@gnu.org)

Version: 1.28

Date: 2004/02/17 12:55:01

Copyright: (C) 1996,2003 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSConditionLock class
  2. Software documentation for the NSLock class
  3. Software documentation for the NSRecursiveLock class
  4. Software documentation for the NSLock(GSCategories) category
  5. Software documentation for the NSRecursiveLock(GSCategories) category
  6. Software documentation for the NSLocking protocol

Software documentation for the NSConditionLock class

NSConditionLock : NSObject

Declared in:
Foundation/NSLock.h
Conforms to:
NSLocking
GCFinalization
Standards:

Description forthcoming.

Method summary

condition

- (int) condition;

Description forthcoming.


initWithCondition:

- (id) initWithCondition: (int)value;

Description forthcoming.


lock

- (void) lock;

Description forthcoming.


lockBeforeDate:

- (BOOL) lockBeforeDate: (NSDate*)limit;

Description forthcoming.


lockWhenCondition:

- (void) lockWhenCondition: (int)value;

Description forthcoming.


lockWhenCondition:beforeDate:

- (BOOL) lockWhenCondition: (int)condition_to_meet beforeDate: (NSDate*)limitDate;

Description forthcoming.


tryLock

- (BOOL) tryLock;

Description forthcoming.


tryLockWhenCondition:

- (BOOL) tryLockWhenCondition: (int)value;

Description forthcoming.


unlock

- (void) unlock;

Description forthcoming.


unlockWithCondition:

- (void) unlockWithCondition: (int)value;

Description forthcoming.


Software documentation for the NSLock class

NSLock : NSObject

Declared in:
Foundation/NSLock.h
Conforms to:
NSLocking
GCFinalization
Standards:

An NSLock is used in multi-threaded applications to protect critical pieces of code. While one thread holds a lock within a piece of code, another thread cannot execute that code until the first thread has given up it's hold on the lock. The limitation of NSLock is that you can only lock an NSLock once and it must be unlocked before it can be aquired again.
Other lock classes, notably NSRecursiveLock, have different restrictions.

Method summary

lock

- (void) lock;

Attempts to aquire a lock, and waits until it can do so.


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, or if the current thread already has the lock (but it waits until the time limit is up before returning NO).


tryLock

- (BOOL) tryLock;

Attempts to aquire a lock, but returns immediately if the lock cannot be aquired. It returns YES if the lock is aquired. It returns NO if the lock cannot be aquired or if the current thread already has the lock.


unlock

- (void) unlock;

Description forthcoming.


Software documentation for the NSRecursiveLock class

NSRecursiveLock : NSObject

Declared in:
Foundation/NSLock.h
Conforms to:
NSLocking
GCFinalization
Standards:

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 (corresponding to the first lock message).

Method summary

lock

- (void) lock;

Description forthcoming.


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.


unlock

- (void) unlock;

Description forthcoming.


Software documentation for the NSLock(GSCategories) category

NSLock(GSCategories)

Declared in:
Foundation/NSLock.h
Standards:

Description forthcoming.

Method summary

newLockAt:

+ (id) newLockAt: (id*)location;

Description forthcoming.


Software documentation for the NSRecursiveLock(GSCategories) category

NSRecursiveLock(GSCategories)

Declared in:
Foundation/NSLock.h
Standards:

Description forthcoming.

Method summary

newLockAt:

+ (id) newLockAt: (id*)location;

Description forthcoming.


Software documentation for the NSLocking protocol

NSLocking

Declared in:
Foundation/NSLock.h
Standards:

Description forthcoming.

Method summary

lock

- (void) lock;

Description forthcoming.


unlock

- (void) unlock;

Description forthcoming.



Up