dragon.mpbridge.synchronize
Dragon’s replacements for the synchronization primitives in Multiprocessing.
Except for Condition
, all components are based on dragon.native
component
and are implemented over one or more dragon channels. Lock
is patched with a
dummy _SemLock
class, so Condition
works out of the box.
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
Classes
Augment the Dragon Native Lock so it can be used by Python Multiprocessing |
|
Dragons replacement for the Multiprocessing Condition removes all references to _semlock and the test for assert_spawning. |
|
- class AugmentedDragonNativeLock
Bases:
Lock
Augment the Dragon Native Lock so it can be used by Python Multiprocessing
- class DragonLock
Bases:
AugmentedDragonNativeLock
- class DragonRLock
Bases:
AugmentedDragonNativeLock
- class DragonCondition
Bases:
Condition
Dragons replacement for the Multiprocessing Condition removes all references to _semlock and the test for assert_spawning. The _semlock interface is mapped onto Dragon’s native Lock implementation.
- class DragonSemaphore
Bases:
Semaphore
- __init__(*args, ctx, **kwargs)
Create a Semaphore object that can be shared across Dragon processes.
- class DragonBoundedSemaphore
Bases:
Semaphore
- __init__(*args, ctx, **kwargs)
Create a Semaphore object that can be shared across Dragon processes.
- class DragonEvent
Bases:
Event
- __init__(*args, ctx, **kwargs)
Initialize an event object :param m_uid: memory pool to create the channel in, defaults to _DEF_MUID :type m_uid: int, optional
- class DragonBarrier
Bases:
Barrier
- __init__(parties: int, action: callable | None = None, timeout: float | None = None, *, ctx=None)
Initialize a barrier object :param parties: number of parties for the barrier to act upon :type parties: int, optional, > 1 :param action: class that the barrier calls upon :type callable: optional :param timeout: timeout for barrier :type timeout: float, optional :param m_uid: memory pool to create the channel in, defaults to _DEF_MUID :type m_uid: int, optional
- class BaseImplBarrier
Bases:
Barrier
- __init__(*args, **kwargs)
Create a barrier, initialised to ‘parties’ threads.
‘action’ is a callable which, when supplied, will be called by one of the threads after they have all entered the barrier and just prior to releasing them all. If a ‘timeout’ is provided, it is used as the default for all subsequent ‘wait()’ calls.
- Lock(ctx=None, use_base_impl=False)
- RLock(ctx=None, use_base_impl=False)
- Condition(lock, ctx=None, use_base_impl=False)
- Semaphore(value, ctx=None, use_base_impl=False)
- BoundedSemaphore(value, ctx=None, use_base_impl=False)
- Event(ctx=None, use_base_impl=False)
- Barrier(parties, action=None, timeout=None, ctx=None, use_base_impl=False)