dragon.native.barrier
The Dragon native barrier is an object for parties number of threads. The class can be initialized with a number of threads, an action, and timeout. The functions are wait, reset, and abort.
Classes
This class implements Barrier objects with a Dragon channel. |
Exceptions
- exception BrokenBarrierError
Bases:
ChannelBarrierBroken
- class Barrier
Bases:
object
This class implements Barrier objects with a Dragon channel. The Barrier handles parties of threads that are 2 and more, number of waiting threads, and whether or not the barrier is broken.
- __init__(parties: int = 2, action: callable = None, timeout: float = None, m_uid: int = 4611686018427387904)
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
- wait(timeout: float = None) int
When all the processes party to the barrier have called wait, they are all released simultaneously. The timeout for wait takes precedence over constructor. :param timeout: timeout for barrier :type timeout: float, optional :rtype: None
- reset() None
Barrier is set to empty state. Any threads waiting receive BrokenBarrierException. :rtype: None
- abort() None
The barrier is broken. Any threads that are in wait state will receive BrokenBarrierError. :rtype: None
- destroy() None
Destroys the underlying Dragon resources so the space can be re-used.
Destroys underlying Dragon resource. Only do this when you know all references to the object have been deleted.
- Returns:
None
- Return type:
NoneType
- property parties
- property n_waiting
- property broken