class documentation
class FileLock(object):
Utility class for file locks.
| Class Method | |
Creates and opens a file to be used as a file-based lock. |
| Method | __del__ |
Undocumented |
| Method | __init__ |
Constructor for FileLock. |
| Method | |
Close the file and release the lock. |
| Method | |
Locks the file in exclusive mode. |
| Method | |
Locks the file in shared mode. |
| Method | |
Unlocks the file. |
| Instance Variable | fd |
Undocumented |
| Instance Variable | filename |
Undocumented |
| Static Method | _ |
Undocumented |
| Method | _flock |
Wrapper for fcntl.flock. |
Creates and opens a file to be used as a file-based lock.
| Parameters | |
| filename:string | path to the file to be locked |
Locks the file in exclusive mode.
| Parameters | |
| blocking:boolean | whether to block and wait until we can lock the file or return immediately |
| timeout:int or None | if not None, the duration to wait for the lock (in blocking mode) |
Locks the file in shared mode.
| Parameters | |
| blocking:boolean | whether to block and wait until we can lock the file or return immediately |
| timeout:int or None | if not None, the duration to wait for the lock (in blocking mode) |
Unlocks the file.
According to flock(2), unlocking can also be a nonblocking operation:
To make a non-blocking request, include LOCK_NB with any of the above operations.
| Parameters | |
| blocking:boolean | whether to block and wait until we can lock the file or return immediately |
| timeout:int or None | if not None, the duration to wait for the lock (in blocking mode) |