blocxx
Public Member Functions | Private Attributes | List of all members
BLOCXX_NAMESPACE::ThreadBarrier Class Reference

The ThreadBarrier class is used to synchronize threads. More...

#include <ThreadBarrier.hpp>

Public Member Functions

 ThreadBarrier (UInt32 threshold)
 Constructor. More...
 
void wait ()
 Synchronize participating threads at the barrier. More...
 
 ~ThreadBarrier ()
 
 ThreadBarrier (const ThreadBarrier &x)
 
ThreadBarrieroperator= (const ThreadBarrier &x)
 

Private Attributes

IntrusiveReference< ThreadBarrierImplm_impl
 

Detailed Description

The ThreadBarrier class is used to synchronize threads.

Each thread that calls wait() will block until threshold number of threads has called wait() This class is freely copyable. All copies reference the same underlying implementation.

Note that descriptions of what exceptions may be thrown assumes that the object is used correctly, i.e., method preconditions are satsified.

Definition at line 89 of file ThreadBarrier.hpp.

Constructor & Destructor Documentation

◆ ThreadBarrier() [1/2]

BLOCXX_NAMESPACE::ThreadBarrier::ThreadBarrier ( UInt32  threshold)

Constructor.

Parameters
thresholdThe number of threads that must call wait() before any of them successfully return from the call. The value specified by threshold must be greater than zero.
Exceptions
ThreadBarrierExceptionif needed system resources exhausted.
std::bad_allocif memory exhausted.

Definition at line 196 of file ThreadBarrier.cpp.

◆ ~ThreadBarrier()

BLOCXX_NAMESPACE::ThreadBarrier::~ThreadBarrier ( )

Definition at line 207 of file ThreadBarrier.cpp.

◆ ThreadBarrier() [2/2]

BLOCXX_NAMESPACE::ThreadBarrier::ThreadBarrier ( const ThreadBarrier x)

Definition at line 211 of file ThreadBarrier.cpp.

Member Function Documentation

◆ operator=()

ThreadBarrier & BLOCXX_NAMESPACE::ThreadBarrier::operator= ( const ThreadBarrier x)

Definition at line 216 of file ThreadBarrier.cpp.

◆ wait()

void BLOCXX_NAMESPACE::ThreadBarrier::wait ( )

Synchronize participating threads at the barrier.

The calling thread shall block until the required number of threads have called wait().

Exceptions
ThreadBarrierException(programmer error only)
ThreadCancelledException

Definition at line 202 of file ThreadBarrier.cpp.

Member Data Documentation

◆ m_impl

IntrusiveReference<ThreadBarrierImpl> BLOCXX_NAMESPACE::ThreadBarrier::m_impl
private

Definition at line 117 of file ThreadBarrier.hpp.


The documentation for this class was generated from the following files: