49 #ifndef LIB_SYNC_BARRIER_H 50 #define LIB_SYNC_BARRIER_H 76 std::atomic_int latch_;
84 REQUIRE (nFold >= 2,
"Pointless to sync less than two participants.");
85 ENSURE (nFold < 100
'000, "Danger territory.... sync 100k Threads??"); 91 size_t level = latch_.fetch_add(-1, std::memory_order_acq_rel); 93 do std::this_thread::yield(); 94 while (0 < latch_.load (std::memory_order_relaxed)); 96 latch_.store (0, std::memory_order_relaxed); 97 } // prevent spurious calls from wrapping 103 #endif /*LIB_SYNC_BARRIER_H*/ Any copy and copy construction prohibited.
Implementation namespace for support and library code.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Lumiera error handling (C++ interface).
A one time N-fold mutual synchronisation barrier.
SyncBarrier(uint nFold=2)