Up
Authors
- Richard Frith-Macdonald (
richard@brainstorm.co.uk
)
-
Version: 1.22
Date: 2005/11/06 13:53:39
Copyright: (C) 1997 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSDistributedLock.h
Availability: OpenStep
This class does not adopt the
<NSLocking>
protocol but supports locking across processes, including processes on different machines, as
long as they can access a common filesystem.
Instance Variables
Method summary
- (void)
breakLock;
Availability: OpenStep
Forces release of the lock whether the receiver owns it or not.
Raises an NSGenericException if unable to remove the lock.
- (id)
initWithPath: (
NSString*)aPath;
Availability: OpenStep
Initialises the receiver 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.
- (
NSDate*)
lockDate;
Availability: OpenStep
Returns the date at which the lock was acquired by any NSDistributedLock using the same path. If nothing has the lock, this returns nil
.
- (BOOL)
tryLock;
Availability: OpenStep
Attempt to acquire the lock and return YES
on success, NO
on failure.
May raise an NSGenericException if a problem occurs.
- (void)
unlock;
Availability: OpenStep
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).
Instance Variables for NSDistributedLock Class
@protected NSString* _lockPath;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
@protected NSDate* _lockTime;
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Up