dragon.mpbridge.synchronize.DragonBarrier

class DragonBarrier

Bases: Barrier

A barrier co-located on the same node by default as the creating process

__init__(parties: int , action: callable = None, timeout: float = 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

Methods

__init__(parties[, action, timeout, ctx])

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

abort()

The barrier is broken.

destroy()

Destroys the underlying Dragon resources so the space can be re-used.

reset()

Barrier is set to empty state.

wait([timeout])

When all the processes party to the barrier have called wait, they are all released simultaneously.

Attributes

broken

n_waiting

parties

__init__(parties: int , action: callable = None, timeout: float = 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

wait(timeout: float = None)

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

abort() None

The barrier is broken. Any threads that are in wait state will receive BrokenBarrierError. :rtype: None

property broken
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 n_waiting
property parties
reset() None

Barrier is set to empty state. Any threads waiting receive BrokenBarrierException. :rtype: None