ACE_Barrier Class Reference
This is a no-op to make ACE "syntactically consistent.".
More...
#include <Barrier.h>
List of all members.
Detailed Description
This is a no-op to make ACE "syntactically consistent.".
Implements "barrier synchronization".
This class allows <count> number of threads to synchronize their completion of (one round of) a task, which is known as "barrier synchronization". After all the threads call <wait()> on the barrier they are all atomically released and can begin a new round.
This implementation uses a "sub-barrier generation numbering" scheme to avoid overhead and to ensure that all threads wait to leave the barrier correct. This code is based on an article from SunOpsis Vol. 4, No. 1 by Richard Marejka (Richard.Marejka@canada.sun.com).
Constructor & Destructor Documentation
ACE_Barrier::ACE_Barrier |
( |
unsigned |
int, |
|
|
const ACE_TCHAR * |
= 0 , |
|
|
void * |
= 0 | |
|
) |
| | [inline] |
ACE_Barrier::~ACE_Barrier |
( |
void |
|
) |
[inline] |
ACE_Barrier::ACE_Barrier |
( |
unsigned int |
count, |
|
|
const ACE_TCHAR * |
name = 0 , |
|
|
void * |
arg = 0 | |
|
) |
| | |
Initialize the barrier to synchronize count threads.
ACE_Barrier::~ACE_Barrier |
( |
void |
|
) |
|
ACE_Barrier::ACE_Barrier |
( |
const ACE_Barrier & |
|
) |
[private] |
Member Function Documentation
void ACE_Barrier::dump |
( |
void |
|
) |
const |
void ACE_Barrier::dump |
( |
void |
|
) |
const [inline] |
void ACE_Barrier::operator= |
( |
const ACE_Barrier & |
|
) |
[private] |
int ACE_Barrier::shutdown |
( |
void |
|
) |
|
Shut the barrier down, aborting the wait of all waiting threads. Any threads waiting on the barrier when it is shut down will return with value -1, errno ESHUTDOWN.
- Return values:
-
| 0 | for success, -1 if already shut down. |
- Since:
- ACE beta 5.4.9.
int ACE_Barrier::wait |
( |
void |
|
) |
|
Block the caller until all count
threads have called wait
and then allow all the caller threads to continue in parallel.
- Return values:
-
| 0 | after successfully waiting for all threads to wait. |
| -1 | if an error occurs or the barrier is shut down ( |
- See also:
- shutdown ()).
int ACE_Barrier::wait |
( |
void |
|
) |
[inline] |
Member Data Documentation
Total number of threads that can be waiting at any one time.
Either 0 or 1, depending on whether we are the first generation of waiters or the next generation of waiters.
Serialize access to the barrier state.
We keep two sub_barriers
, one for the first "generation" of waiters, and one for the next "generation" of waiters. This efficiently solves the problem of what to do if all the first generation waiters don't leave the barrier before one of the threads calls wait() again (i.e., starts up the next generation barrier).
The documentation for this class was generated from the following files: