Lumiera  0.pre.03
»edit your freedom«
SyncBarrier Class Reference

#include "lib/sync-barrier.hpp"

Description

A one time N-fold mutual synchronisation barrier.

Calls to #sync() will block until N such calls occurred.

Note
The blocking wait is implemented by a check-and-yield() loop, increasing load at the OS scheduler, possibly starving the system when stretched out over extended time.
Remarks
intended use is to allow all participants to catch up and reach a well defined point with initialisation or implementation logic.
See also
SyncBarrierPerformance_test::run for actual performance measurements!

Definition at line 73 of file sync-barrier.hpp.

Public Member Functions

 SyncBarrier (uint nFold=2)
 
void sync ()
 

Private Attributes

std::atomic_int latch_
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Constructor & Destructor Documentation

◆ SyncBarrier()

SyncBarrier ( uint  nFold = 2)
inlineexplicit
Parameters
nFoldthe number of participants to sync (min. 2)

Definition at line 81 of file sync-barrier.hpp.

+ Inheritance diagram for SyncBarrier:
+ Collaboration diagram for SyncBarrier:

The documentation for this class was generated from the following file: