files.lock
files.lock
Functions
| Name | Description |
|---|---|
| LockFile | Create a blocking context with a lock file |
LockFile
files.lock.LockFile(
locked_file,
ext='.lock',
interval=1,
timeout=0,
create_dir=True,
)Create a blocking context with a lock file
timeout: timeout in seconds, waiting to the lock to be released. If negative, disable lock files entirely.
interval: interval in seconds
Example: with LockFile(‘/dir/to/file.txt’): # create a file ‘/dir/to/file.txt.lock’ including a filesystem lock # the context will enter once the lock is released