Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWBarrier


Base Class

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Member Functions

Package

Synchronization

Header File

#include <rw/sync/RWBarrier.h>

Description

Use an RWBarrier object to synchronize a number of concurrent threads at a specific point in their processing. Each thread indicates that it has reached the "barrier" by calling the wait() member function. Each thread is blocked by the call to wait() until the number of threads specified in the RWBarrier constructor have all called wait(). When the last thread calls wait(), all threads waiting at the barrier are unblocked, making them eligible for execution.

Initializing an RWBarrier with a zero count is not legal; an assertion will be triggered in debug mode. Using an RWBarrier with a count different than the number of threads able to perform a wait() on that RWBarrier is outside the intended use of the class. There is no diagnostic available to detect this condition.

An RWBarrier's count may be changed after initialization by using the setCount(int) function. No threads must be blocked in wait() when this function is called. In debug mode, if there are threads blocked in wait(), an assertion will be triggered; in release mode, an exception will be thrown.

When an RWBarrier is destroyed, no threads should be blocked in the wait() function. When the library is built in debug mode, an assertion will be raised if there are threads waiting when the RWBarrier is destructed.

Example

Public Constructor

RWBarrier(int count=1);

Public Destructor

~RWBarrier(void);

Public Member Functions

void
setCount(int count);
void
wait(void);

Private Copy Constructor

RWBarrier(const RWBarrier&);

Private Member Operator

RWBarrier&
operator=(const RWBarrier&);


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.