#include <CancelableTask.h>
Inheritance diagram for CancelableTask:
Public Methods | |
CancelableTask () | |
Create a CancelableTask. | |
virtual | ~CancelableTask () throw () |
Destroy the CancelableTask. | |
virtual void | cancel () |
virtual bool | isCanceled () |
virtual void | run () throw () |
Protected Methods | |
virtual void | doRun ()=0 throw () |
Disabling
A cancel()ed CancelableTask will not execute if is is canceled prior to being run(). If it is canceled while it is running, the thread executing the task will be interrupted. This gives the executing task a chance to respond to being canceled.
Exiting
A canceled task should exit cleanly and quickly. Depending on the task this may involve rolling back to some previous state, updating a log, etc. Its up to the specific task to decide how to best handle being canceled during execution.
|
Cancel this task. This will be successful only once, cancel()ing multiple times will result in an exception. A task that has been canceled will not run. A task that is executing will be interrupted.
Implements Cancelable. |
|
Specializations of this class must define this method. It is called when a CancelableTask that has not been canceled is run().
|
|
Check the canceled status of this task.
Implements Cancelable. |
|
A CancelableTask will run only if it has not been canceled prior to calling this function. If the task has not been canceled at the time this function is called, then doRun() is executed. Implements Runnable. |