is_task_cancellation_requested Function

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic
Visual Studio 2012

Returns whether the task that is currently executing has received a request to cancel its execution. Cancellation is requested on a task if it was created with a cancellation token, and the source that's associated with that token is canceled.

bool __cdecl is_task_cancellation_requested();

true if the currently executing task has received a request for cancellation; otherwise, false.

If you call this method in the body of a task and it returns true, you must respond with a call to cancel_current_task to acknowledge the cancellation request, after you perform any cleanup that's required. This aborts the execution of the task and causes it to enter into the canceled state. If you don't respond and continue execution, or return instead of calling cancel_current_task, the task enters the completed state when it is done.

A task is not cancellable if it was created without a cancellation token.

Header: ppltasks.h

Namespace: concurrency

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.