Locking
from uwsgiconf.runtime.locking import lock
@lock ()
def locked ():
"""This function will be locked with default (0) lock."""
...
# or
with lock ( 2 ):
# Code under this context manager will be locked with lock 2.
...
Attributes
lock
Convenience alias for Lock.
Classes
Lock
Locks related stuff.
Lock number 0 is always available. More locks need to be registered
with .config.locking.set_basic_params(count=X) where X is the number of locks.
Note
The same lock should be released before next acquiring.
Can be used as context manager:
.. code-block:: python
with Lock():
do()
Can de used as a decorator:
.. code-block:: python
@Lock()
def do():
pass
is_set
"Checks whether the lock is active.
ValueError For Spooler or invalid lock number
acquire
Sets the lock.
ValueError For Spooler or invalid lock number
release
Unlocks the lock.
ValueError For Spooler or invalid lock number