he SignaledCountingBarrier::waitForOpen() member function blocks every thread
that calls it unless the number of threads blocked on this function reaches
certain number. If such number is reached then all threads are released and
the function returns false for the one thread that arrived last and true for
all other threads. Such maximal number of locked threads is dictated by the
only parameter of the constructor.
The other functions of the public interface are the
SignaledCountingBarrier::openOne() and openAll(). These cause immediate
release of one (all) of the threads blocked at waitForOpen() if there is at
least one such thread. If there is no such thread then the function has no
effect.
The following is the public interface of the SignaledCountingBarrier.
class
SignaledCountingBarrier : boost::noncopyable
{
public:
explicit
SignaledCountingBarrier( unsigned char nThreads );
bool
waitForOpen() volatile;
void
openOne() volatile;
void
openAll() volatile;
};
The member functions throw either ots::config::ThreadResourceError
(=boost::thread_resource_error by default ots::config setting) or
ots::ThreadInterrupted (=boost::thread_interrupted).
|