Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWCancellation


RWTHRxmsg RWCancellation... RWHandleBase

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

None

Package

Threading

Header File

#include <rw/thread/RWCancellation.h>

Description

RWCancellation is an exception which is thrown to cancel a thread. It may be caught by the thread in order to clean up resources or perform final shutdown operations. Thread cancellation allows one to stop a thread at a safe point in its execution. Thread cancellation is especially useful for stopping threads that are executing in infinite loops.

A thread is cancelled when an external thread calls requestCancellation() on the RWRunnable object. The thread cancellation starts when RWRunnable::serviceCancellation() is called from within the cancelled thread. If cancellation has been requested on that thread, via RWRunnable::requestCancellation(), then an RWCancellation exception is thrown out of RWRunnable::serviceCancellation().

RWRunnable::serviceCancellation() will also be called implicitly from within the acquire() or wait() methods of a synchronization object, when that synchronization object has been initialized with RW_CANCELLATION_ ENABLED. A global function called rwServiceCancellation() may also be used as a substitute for RWRunnable::serviceCancellation() member function.

Example

Constructors

RWCancellation(RWRunnableImp* runnableImpP);
RWCancellation(const RWCancellation& second);

See Also

RWRunnable, rwServiceCancellation



Previous fileTop of DocumentContentsIndexNext file

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