Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWCancellation

Module:  Threads   Package:  Threading


RWTHRxmsg RWCancellation... RWHandleBase

Local Index

Members

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

Public Constructors

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

See Also

RWRunnable, rwServiceCancellation()



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.