Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWRunnableTrap


RWRunnableTrap RWHandleBase

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

Member Functions

Package

Threading

Header File

#include <rw/thread/RWRunnableTrap.h> 

Description

RWRunnableTrap allows you to wait for a number of runnables or threads to reach a certain execution state. When you create an RWRunnableTrap you specify the target execution state. This causes any runnable that the trap has been set on to catch the runnable when it reaches the given execution state.

Another thread can get each runnable as it reaches the target execution state by calling the getNext() function of the runnable trap. A runnable may be caught by the trap by calling setTrap() and passing in the target runnable. By default the runnable is caught only once, the first time that it enters the execution state. When you set the trap on a runnable you may specify that the runnable be caught repeatedly, each time that it enters the execution state.

A common usage of an RWRunnableTrap is to wait for a number of threads to complete execution. This allows you to launch and wait for multiple threads without having to keep track of those threads in an array or other data structure. After a thread is created, but before it is started, it can be added to a runnable trap.

The default target execution state is RW_THR_INITIAL which is the state that a runnable reaches when it completes execution.

Example

Constructors

RWRunnableTrap(void);
RWRunnableTrap(RWStaticCtor);
RWRunnableTrap(const RWRunnableTrap& second);

Destructor

~RWRunnableTrap(void);

Public Member Operator

RWRunnableTrap&
operator=(const RWRunnableTrap& second)

Public Member Functions

RWRunnable 
getNext(void);
RWWaitStatus
getNext(RWRunnable &r, unsigned long milliseconds);
void 
getNext(RWRunnable& r, RWExecutionState& es);
RWWaitStatus
getNext(RWRunnable& r, RWExecutionState& es, 
        unsigned long milliseconds)
RWBoolean 
isEmpty(void) const;
static
RWRunnableTrap
make(unsigned long executionStateMask=RW_THR_INITIAL);
void
setTrap(RWRunnable runnable, 
        RWCallbackScope scope=RW_CALL_ONCE);
RWBoolean
tryGetNext(RWRunnable& runnable);
RWBoolean
tryGetNext(RWRunnable& runnable, RWExecutionState& es);

Protected Constructor

RWRunnableTrap(RWRunnableTrapImp* runnableTrapImpP);

See Also

RWRunnable



Previous fileTop of DocumentContentsIndexNext file

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