Monitoring the Completion State of a Runnable
Each runnable maintains an internal completion state value that can be queried to determine whether a runnable has completed execution and what conditions led to the runnable’s completion. Once you have started or joined with a runnable, you can use the RWRunnableHandle::getCompletionState() function to check the completion state of the runnable.
*The completion state for a runnable that has not yet been started or not yet completed is RW_THR_PENDING.
*If the runnable completion state is RW_THR_FAILED, an exception was thrown within the runnable. You can rethrow the exception by calling the RWRunnable::raise() member. The raise function can be called at any time, and does nothing if no exception has been captured by the runnable.
*If the completion state is RW_THR_CANCELED, the runnable was successfully canceled, either by another thread, or of its own accord.
*A completion state of RW_THR_TERMINATED indicates that the runnable’s active thread was terminated.