The pplx namespace provides classes and functions that give you access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.
More...
cancellation_token class represents the ability to determine whether some operation has been requested to cancel. A given token can be associated with a task_group, structured_task_group, or task to provide implicit cancellation. It can also be polled for cancellation or have a callback registered for if and when the associated cancellation_token_source is canceled. More... cancellation_token_registration class represents a callback notification from a cancellation_token . When the register method on a cancellation_token is used to receive notification of when cancellation occurs, a cancellation_token_registration object is returned as a handle to the callback so that the caller can request a specific callback no longer be made through use of the deregister method. More... cancellation_token_source class represents the ability to cancel some cancelable operation. More... task class. A task object represents work that can be executed asynchronously, and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type _ResultType on successful completion. Tasks of type task<void> produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations(then), and join(when_all) and choice(when_any) patterns. More... task class. A task object represents work that can be executed asynchronously, and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type _ResultType on successful completion. Tasks of type task<void> produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations(then), and join(when_all) and choice(when_any) patterns. More... get() method on task, for a canceled task. More... task_completion_event class allows you to delay the execution of a task until a condition is satisfied, or start a task in response to an external event. More... task_completion_event class allows you to delay the execution of a task until a condition is satisfied, or start a task in response to an external event. More... task_continuation_context class allows you to specify where you would like a continuation to be executed. It is only useful to use this class from a Windows Store app. For non-Windows Store apps, the task continuation's execution context is determined by the runtime, and not configurable. More... void (__cdecl * TaskProc_t)(void *). A TaskProc is called to invoke the body of a task. More... completed and canceled. More... task_group or structured_task_group object. A value of this type is returned by numerous methods that wait on tasks scheduled to a task group to complete. More... canceled state. While it may be used in response to the is_task_cancellation_requested function, you may also use it by itself, to initiate cancellation of the task that is currently executing. More... create_task can be used anywhere you would have used a task constructor. It is provided mainly for convenience, because it allows use of the auto keyword while creating tasks. More... The pplx namespace provides classes and functions that give you access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.
Default scheduler type
A type that represents the terminal state of a task. Valid values are completed and canceled.
An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *). A TaskProc is called to invoke the body of a task.
Describes the execution status of a task_group or structured_task_group object. A value of this type is returned by numerous methods that wait on tasks scheduled to a task group to complete.
| Enumerator | |
|---|---|
| not_complete |
The tasks queued to the |
| completed |
The tasks queued to the |
| canceled |
The |
Scheduler Interface
Cancels the currently executing task. This function can be called from within the body of a task to abort the task's execution and cause it to enter the canceled state. While it may be used in response to the is_task_cancellation_requested function, you may also use it by itself, to initiate cancellation of the task that is currently executing.
It is not a supported scenario to call this function if you are not within the body of a task. Doing so will result in undefined behavior such as a crash or a hang in your application.
Creates a PPL task object. create_task can be used anywhere you would have used a task constructor. It is provided mainly for convenience, because it allows use of the auto keyword while creating tasks.
task_completion_event object, a different task object, or a Windows::Foundation::IAsyncInfo interface if you are using tasks in your Windows Store app. T, that is inferred from _Param . The first overload behaves like a task constructor that takes a single parameter.
The second overload associates the cancellation token provided with the newly created task. If you use this overload you are not allowed to pass in a different task object as the first parameter.
The type of the returned task is inferred from the first parameter to the function. If _Param is a task_completion_event<T>, a task<T>, or a functor that returns either type T or task<T>, the type of the created task is task<T>.
In a Windows Store app, if _Param is of type Windows::Foundation::IAsyncOperation<T>^ or Windows::Foundation::IAsyncOperationWithProgress<T,P>^, or a functor that returns either of those types, the created task will be of type task<T>. If _Param is of type Windows::Foundation::IAsyncAction^ or Windows::Foundation::IAsyncActionWithProgress<P>^, or a functor that returns either of those types, the created task will have type task<void>.
Gets the ambient scheduler to be used by the PPL constructs
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.
true if the currently executing task has received a request for cancellation, false otherwise. 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.
Sets the ambient scheduler to be used by the PPL constructs.