Compartilhar via


is_task_cancellation_requested Function (C++ REST SDK)

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

Warning

This topic contains information for the C++ REST SDK 1.0 (codename "Casablanca"). If you are using a later version from the Codeplex Casablanca web page, then use the local documentation at http://casablanca.codeplex.com/documentation.

inline bool __cdecl is_task_cancellation_requested();

Return Value

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

Remarks

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 performing any cleanup you need. This will abort the execution of the task and cause it to enter into the canceled state. If you do not respond and continue execution, or return instead of calling cancel_current_task, the task will enter the completed state when it is done. state.

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

Requirements

Header: pplxtasks.h

Namespace: pplx

See Also

Reference

pplx Namespace

task Class

cancellation_token_source Class

cancellation_token Class

cancel_current_task Function