Registering the Callback
To register a callback, use the RWRunnableHandle::addCallback() function. This function accepts:
*An RWTFunctor instance.
*An execution state mask value.
*An RWCallbackScope enumerated value that tells the runnable whether the callback should be invoked just once and deleted (RW_CALL_ONCE), or invoked as many times as the execute state requires to satisfy the mask (RW_CALL_REPEATEDLY).
Example 17 – Registering a callback
RWRunnable runnable = ...;
// Register callback that will be invoked each time the
// the runnable is started or completes execution...
runnable.addCallback(myFunctor,
RW_THR_INITIAL | RW_THR_RUNNING,
RW_CALL_REPEATEDLY);
As with the RWRunnable::wait() function, the execution state mask value can specify one or more execution states that trigger the callback. The execution states are ORed together to form the final mask value.