Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXCompletion Class Reference

A completion counter allows a single thread to monitor a number of ongoing concurrent activities for completion. More...

#include <FXCompletion.h>

Public Member Functions

 FXCompletion ()
 Initialize completion counter.
 
FXuint count () const
 Return current counter value.
 
void increment (FXuint cnt=1)
 Increment counter by cnt.
 
void decrement (FXuint cnt=1)
 Decrement counter by cnt.
 
void wait ()
 Wait till count becomes zero again.
 
FXbool wait (FXTime nsec)
 Wait till count becomes zero, or timeout; return false if timed out.
 
FXbool done () const
 Return true if count is zero.
 
 ~FXCompletion ()
 Wait till count becomes zero, then destroy.
 

Detailed Description

A completion counter allows a single thread to monitor a number of ongoing concurrent activities for completion.

Each activity calls increment() on the completion counter when started, and decrement() when finished. The monitoring thread can call wait(), wait(nsec), or done() to determine the status of the concurrent activity. Only one thread is allowed to call any of the wait() functions; but multiple threads can call increment() or decrement(). The completion counter can not be destroyed until the last thread decrements the counter back down to zero.


The documentation for this class was generated from the following file:

Copyright © 1997-2022 Jeroen van der Zijp