barrier |
A barrier is synchronization primitive that allows multiple threads to reach a specific point and wait before they all can proceed. For example, threads completing a matrix computation can wait at a barrier until all threads have finished the current phase of the parallel computation, before they all can proceed to the next phase of the computation. A barrier object contains a counter which is initialized with a thread count when the barrier is created. The thread count represents the number of waiting threads that can wait in the barrier group. When each thread reaches the barrier it calls the barrier wait() method. The wait() method decrements the thread counter. When the last thread reaches the barrier and calls the wait() method, the count goes to zero. The barrier object then unblocks all the waiting threads in the barrier group to proceed.
Thread<ToolKit>
#include <ospace/thread/barrier.h>
class os_barrier
Throws: os_thread_toolkit_error
Throws: os_thread_toolkit_error
true for the last thread
that unblocks all other waiting threads.Throws: os_thread_toolkit_error
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.