class documentation

class twisted.python.lockfile.FilesystemLock: (source)

Known subclasses: twisted.internet.defer.DeferredFilesystemLock

View In Hierarchy

A mutex.

This relies on the filesystem property that creating a symlink is an atomic operation and that it will fail if the symlink already exists. Deleting the symlink will release the lock.

Instance Variable name The name of the file associated with this lock.
Instance Variable clean Indicates whether this lock was released cleanly by its last owner. Only meaningful after lock has been called and returns True.
Instance Variable locked Indicates whether the lock is currently held by this object.
Method __init__ Undocumented
Method lock Acquire this lock.
Method unlock Release this lock.
name = (source)
The name of the file associated with this lock.
clean = (source)
Indicates whether this lock was released cleanly by its last owner. Only meaningful after lock has been called and returns True.
locked = (source)
Indicates whether the lock is currently held by this object.
(type: bool)
def __init__(self, name): (source)
def lock(self): (source)

Acquire this lock.

ReturnsTrue if the lock is acquired, false otherwise. (type: bool)
RaisesOSErrorAny exception os.symlink() may raise, other than errno.EEXIST.
def unlock(self): (source)

Release this lock.

This deletes the directory with the given name.

RaisesOSErrorAny exception os.readlink() may raise.
ValueErrorIf the lock is not owned by this process.
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.