Up

NSDistributedLock class reference

Authors

Richard Frith-Macdonald (richard@brainstorm.co.uk)

Version: 1.17

Date: 2003/09/04 16:44:37

Copyright: (C) 1997 Free Software Foundation, Inc.

Software documentation for the NSDistributedLock class

NSDistributedLock : NSObject

Declared in:
Foundation/NSDistributedLock.h
Standards:

Description forthcoming.



Instance Variables for NSDistributedLock Class

_lockPath

@private NSString* _lockPath;

Description forthcoming.


_lockTime

@private NSDate* _lockTime;

Description forthcoming.





Method summary

lockWithPath: 

+ (NSDistributedLock*) lockWithPath: (NSString*)aPath;

Return a distributed lock for aPath. See -initWithPath: for details.


breakLock 

- (void) breakLock;

Forces release of the lock whether the receiver owns it or not.
Raises an NSGenericException if unable to remove the lock.


initWithPath: 

- (id) initWithPath: (NSString*)aPath;

Initialises the reciever with the specified filesystem path.
The location in the filesystem must be accessible for this to be usable. That is, the processes using the lock must be able to access, create, and destroy files at the path.
The directory in which the last path component resides must already exist... create it using NSFileManager if you need to.


lockDate 

- (NSDate*) lockDate;

Returns the date at which the lock was aquired by any NSDistributedLock using the same path. If nothing has the lock, this returns nil .


tryLock 

- (BOOL) tryLock;

Attempt to aquire the lock and return YES on success, NO on failure.
May raise an NSGenericException if a problem occurs.


unlock 

- (void) unlock;

Releases the lock. Raises an NSGenericException if unable to release the lock (for instance if the receiver does not own it or another process has broken it).



Up