HPCxx_CSem
HPCxx_CSem provide a way to wait for a group of threads to
synchronize termination of a number of tasks. When constructed, a limit
value is supplied and a counter is set to zero. A thread executing
waitAndReset() will suspend until the counter reaches the
"limit" value. The counter is then reset to zero. The overloaded ``++''
operator increments the counter by one.
By passing a reference to a HPCxx_CSem to a group of threads
each of which does a ``++'' prior to exit, you can build a multi-threaded
"join" operation.
Class Definition
class HPCxx_CSem{
public:
HPCxx_CSem(int limit);
// prefix and postfix ++ operators.
HPCxx_CSem& operator++();
const HPCxx_CSem& operator++();
HPCxx_CSem& operator++(int);
const HPCxx_CSem& operator++(int);
waitAndReset(); // wait until the count reaches the limit
// then reset the counter to 0 and exit.
};
Examples
hpc++@extreme.indiana.edu
Last modified: Thu Apr 22 02:26:01 EST 1999