csp::Bucket Class Reference

Inheritance diagram for csp::Bucket:

boost::noncopyable List of all members.

Detailed Description

A bucket is a synchronisation primitive.

Processes "fall into" a bucket and wait until the bucket is "flushed".

Unlike a barrier, which has a concept of enrollment and waits until all processes are ready to synchronise, any process can fall into a bucket, and they are all released when any process calls flush.

The use of buckets is also covered in the appropriate tutorial section on buckets.

C++CSP v1.x Compatibility

Bucket is almost identical to its C++CSP v1.x version. The only differences are that the return type of the flush method has changed, and the holding method has also changed (it is no longer const, and its return type has changed). The semantics are the same as they ever were.


Public Member Functions

void fallInto ()
 Waits until the bucket is flushed.
usign32 flush ()
 Flushes the bucket, freeing all process that were waiting on it.
usign32 holding ()
 Gets the number of processes currently "in" (waiting on) the bucket.


Member Function Documentation

void csp::Bucket::fallInto (  )  [inline]

Waits until the bucket is flushed.

Any process may fall into a bucket (i.e. no enrollment is needed). It will then wait until another process calls the flush() function.

usign32 csp::Bucket::flush (  )  [inline]

Flushes the bucket, freeing all process that were waiting on it.

When flush() is called, all processes that have previously "fallen into" the bucket (since the last flush) are freed. The bucket then becomes empty.

C++CSP v1.x Compatibility

In C++CSP v1.x the return type of this method was void. This change should not break any existing code.

Returns:
The number of processes that were freed by this flush. It may be zero if no processes were waiting.

usign32 csp::Bucket::holding (  )  [inline]

Gets the number of processes currently "in" (waiting on) the bucket.

C++CSP v1.x Compatibility

This method used to be const and return int. It now returns usign32 and is not const. You may have to adjust existing code.

Returns:
The number of processes currently "in" (i.e. waiting on) the bucket.


Generated on Mon Aug 20 12:24:28 2007 for C++CSP2 by  doxygen 1.4.7