Tulip_CSem
Tulip_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 Tulip_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 Tulip_CSem{
public:
Tulip_CSem(int limit);
// prefix and postfix ++ operators.
Tulip_CSem& operator++();
const Tulip_CSem& operator++();
Tulip_CSem& operator++(int);
const Tulip_CSem& operator++(int);
waitAndReset(); // wait until the count reaches the limit
// then reset the counter to 0 and exit.
};
Examples
Suvas Vajracharya
Last
modified: Wed Oct 22 13:49:39 EST 1997