chsvlib
chsv helper source code

◆ arrive()

arrival_token arrive ( std::ptrdiff_t  n = 1)

Implements arrival of a specified number of threads to the barrier.

Parameters
nA number of threads arriving to the barrier. The behaviour is undefined, if n is less than zero or greater than the number of threads the barrier is currently waiting to arrive.
Returns
A value which is associated with the current barrier synchronization phase for which the arrival has taken place. The value can be passed as a parameter of the wait method to wait for completion of the current synchronization phase.

The method may cause opening of the barrier and the call of the completion routine.

Provided that bar is an instance of a barrier, the following two code snippets perform equivalent actions. That is,

bar.wait(bar.arrive());

is equivalent to

bar.arrive_and_wait();