mutapath.lock_dummy.DummyFileLock
- class mutapath.lock_dummy.DummyFileLock(lock_file: str | os.PathLike[Any], timeout: float = -1, mode: int = 420, thread_local: bool = True)[source]
Bases:
BaseFileLock
Create a new lock object.
- Parameters:
lock_file – path to the file
timeout – default timeout when acquiring the lock, in seconds. It will be used as fallback value in
the acquire method, if no timeout value (
None
) is given. If you want to disable the timeout, set it to a negative value. A timeout of 0 means, that there is exactly one attempt to acquire the file lock. :param mode: file permissions for the lockfile. :param thread_local: Whether this object’s internal context should be thread local or not. If this is set toFalse
then the lock will be reentrant across threads.- __init__(lock_file: str | os.PathLike[Any], timeout: float = -1, mode: int = 420, thread_local: bool = True) None [source]
Create a new lock object.
- Parameters:
lock_file – path to the file
timeout – default timeout when acquiring the lock, in seconds. It will be used as fallback value in
the acquire method, if no timeout value (
None
) is given. If you want to disable the timeout, set it to a negative value. A timeout of 0 means, that there is exactly one attempt to acquire the file lock. :param mode: file permissions for the lockfile. :param thread_local: Whether this object’s internal context should be thread local or not. If this is set toFalse
then the lock will be reentrant across threads.
Methods
acquire
([timeout, poll_intervall])Doing nothing
- return:
a flag indicating if this lock is thread local or not
release
([force])Doing nothing
Attributes
A boolean indicating if the lock file is holding the lock currently.
The number of times this lock has been acquired (but not yet released).
path to the lock file
the default timeout value, in seconds