Threading-related utilities
This module provides a degree of platform independence for thread support.
At the moment, it only really provides conditional allocate_lock() and
get_ident() functions, but other API's may be added in the future.
By default, this module will use thread support if it is available. You
can override this, however, by using the disableThreading(),
allowThreading(), or requireThreading() API function, preferably at the
start of your program before any other modules have a chance to use any
of this module's APIs.
|
Functions
|
|
allocate_lock
allowThreading
disableThreading
requireThreading
|
|
|
allocate_lock
|
allocate_lock ()
Returns either a real or dummy thread lock, depending on availability
|
|
|
allowThreading
|
allowThreading ()
Enable the use of real thread locks, if possible
|
|
|
disableThreading
|
disableThreading ()
Don't use threads, even if we have them.
Note that this must be called before any locks have been allocated, as it
only affects subsequent allocations.
|
|
|
requireThreading
|
requireThreading ()
Raise RuntimeError if threads aren't available; otherwise enable them
|
Exceptions
|
|
RuntimeError, "Threads required but not available"
|
|
|
Classes
|
|
DummyLock |
Dummy lock type used when threads are inactive or unavailable
|
RLock |
Re-entrant lock; can be locked multiple times by same thread
|
ResourceManager |
Hold/manage thread locks for arbitrary resource keys
|
|
|