40 #ifndef LIB_SYNC_BARRIER_H 41 #define LIB_SYNC_BARRIER_H 67 std::atomic_int latch_;
75 REQUIRE (nFold >= 2,
"Pointless to sync less than two participants.");
76 ENSURE (nFold < 100
'000, "Danger territory.... sync 100k Threads??"); 82 size_t level = latch_.fetch_add(-1, std::memory_order_acq_rel); 84 do std::this_thread::yield(); 85 while (0 < latch_.load (std::memory_order_relaxed)); 87 latch_.store (0, std::memory_order_relaxed); 88 } // prevent spurious calls from wrapping 94 #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)