diff options
Diffstat (limited to 'lib/spack/llnl/util/lock.py')
-rw-r--r-- | lib/spack/llnl/util/lock.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/spack/llnl/util/lock.py b/lib/spack/llnl/util/lock.py index cd390693c4..0c0cc7f634 100644 --- a/lib/spack/llnl/util/lock.py +++ b/lib/spack/llnl/util/lock.py @@ -14,9 +14,19 @@ import llnl.util.tty as tty import spack.util.string -__all__ = ['Lock', 'LockTransaction', 'WriteTransaction', 'ReadTransaction', - 'LockError', 'LockTimeoutError', - 'LockPermissionError', 'LockROFileError', 'CantCreateLockError'] +__all__ = [ + 'Lock', + 'LockDowngradeError', + 'LockUpgradeError', + 'LockTransaction', + 'WriteTransaction', + 'ReadTransaction', + 'LockError', + 'LockTimeoutError', + 'LockPermissionError', + 'LockROFileError', + 'CantCreateLockError' +] #: Mapping of supported locks to description lock_type = {fcntl.LOCK_SH: 'read', fcntl.LOCK_EX: 'write'} @@ -401,7 +411,7 @@ class Lock(object): """Releases a read lock. Arguments: - release_fn (callable): function to call *before* the last recursive + release_fn (typing.Callable): function to call *before* the last recursive lock (read or write) is released. If the last recursive lock will be released, then this will call @@ -437,7 +447,7 @@ class Lock(object): """Releases a write lock. Arguments: - release_fn (callable): function to call before the last recursive + release_fn (typing.Callable): function to call before the last recursive write is released. If the last recursive *write* lock will be released, then this @@ -533,10 +543,10 @@ class LockTransaction(object): Arguments: lock (Lock): underlying lock for this transaction to be accquired on enter and released on exit - acquire (callable or contextmanager): function to be called after lock - is acquired, or contextmanager to enter after acquire and leave + acquire (typing.Callable or contextlib.contextmanager): function to be called + after lock is acquired, or contextmanager to enter after acquire and leave before release. - release (callable): function to be called before release. If + release (typing.Callable): function to be called before release. If ``acquire`` is a contextmanager, this will be called *after* exiting the nexted context and before the lock is released. timeout (float): number of seconds to set for the timeout when |