Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
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 64 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 ()=default
 
 NonCopyable ()=default
 
 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 72 of file sync-barrier.hpp.

Member Function Documentation

◆ sync()

void sync ( )
inline

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

References SyncBarrier::latch_.

Referenced by TestThread::TestThread(), CallQueue_test::Worker::Worker(), SessionCommandFunction_test::perform_massivelyParallel(), SyncBarrier_test::run(), DispatcherLoop::runSessionThread(), and lib::test::threadBenchmark().

+ Here is the caller graph for this function:

Member Data Documentation

◆ latch_

std::atomic_int latch_
private

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

Referenced by SyncBarrier::sync().

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

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