_lib._threadsafety

Module Contents

Classes

Functions

class ReentrancyError
class ReentrancyLock(err_msg)

Threading lock that raises an exception for reentrant calls.

Calls from different threads are serialized, and nested calls from the same thread result to an error.

The object can be used as a context manager, or to decorate functions via the decorate() method.

__init__(err_msg)
__enter__()
__exit__(type, value, traceback)
decorate(func)
non_reentrant(err_msg=None)

Decorate a function with a threading lock and prevent reentrant calls.