Contents
CyclicBarrier

Overview

A synchronising barrier that can be configured for an arbitrary number of threads.

The barrier automatically resets after releasing the threads.

The barrier can be reconfigured for a different number of threads. It is the responsibility of the using code to ensure that the barrier is not being used when reconfigured.

Quick start

#include <Balau/Concurrent/CyclicBarrier.hpp>

Using the cyclic barrier is simple. The barrier is constructed or reconfigured with the number of threads that will wait before the barrier will release the threads and reset.

			// Create a cyclic barrier.
			CyclicBarrier barrier(4);

			// Reconfigure the cyclic barrier.
			barrier.reconfigure(2);
		

Then each participating thread calls the barrier.

			/// Count down the barrier, blocking if the count has not reached 0.
			barrier.countdown();