STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Namespaces | Macros | Typedefs | Functions
ppltasks.h File Reference
#include <pplwin.h>
#include <functional>
#include <vector>
#include <utility>
#include <exception>
#include <algorithm>
#include <mutex>

Go to the source code of this file.

Classes

class  Concurrency::task< _ReturnType >
 The Parallel Patterns Library (PPL) 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...
 
struct  Concurrency::details::_DefaultTaskHelper
 
class  Concurrency::details::_TaskCreationCallstack
 Callstack container, which is used to capture and preserve callstacks in ppltasks. Members of this class is examined by vc debugger, thus there will be no public access methods. Please note that names of this class should be kept stable for debugger examining. More...
 
struct  Concurrency::details::_TypeSelectorNoAsync
 
struct  Concurrency::details::_TypeSelectorAsyncOperationOrTask
 
struct  Concurrency::details::_TypeSelectorAsyncOperation
 
struct  Concurrency::details::_TypeSelectorAsyncTask
 
struct  Concurrency::details::_TypeSelectorAsyncAction
 
struct  Concurrency::details::_TypeSelectorAsyncActionWithProgress
 
struct  Concurrency::details::_TypeSelectorAsyncOperationWithProgress
 
struct  Concurrency::details::_NormalizeVoidToUnitType< _Ty >
 
struct  Concurrency::details::_NormalizeVoidToUnitType< void >
 
struct  Concurrency::details::_IsUnwrappedAsyncSelector< _Ty >
 
struct  Concurrency::details::_IsUnwrappedAsyncSelector< _TypeSelectorNoAsync >
 
struct  Concurrency::details::_UnwrapTaskType< _Ty >
 
struct  Concurrency::details::_UnwrapTaskType< task< _Ty > >
 
struct  Concurrency::details::_IsIAsyncInfo< _Type >
 
struct  Concurrency::details::_TaskTypeTraits< _Type, _IsAsync >
 
struct  Concurrency::details::_TaskTypeTraits< void >
 
struct  Concurrency::details::_BadContinuationParamType
 
struct  Concurrency::details::_FunctionTypeTraits< _Function, _ExpectedParameterType >
 
struct  Concurrency::details::_FunctionTypeTraits< _Function, void >
 
struct  Concurrency::details::_ContinuationArgTypeHelper< _Ty, _IsTaskType >
 
struct  Concurrency::details::_ContinuationArgTypeHelper< _Ty, std::true_type >
 
struct  Concurrency::details::_ContinuationTypeTraits< _Function, _ReturnType >
 
struct  Concurrency::details::_InitFunctorTypeTraits< _TaskType, _FuncRetType >
 
struct  Concurrency::details::_InitFunctorTypeTraits< _Ty, _Ty >
 
struct  Concurrency::details::_TaskProcThunk
 Helper object used for LWT invocation. More...
 
struct  Concurrency::details::_TaskProcThunk::_Holder
 
class  Concurrency::details::_ContextCallback
 
struct  Concurrency::details::_ResultHolder< _Type >
 
struct  Concurrency::details::_ResultHolder< std::vector< bool > >
 
struct  Concurrency::details::_ExceptionHolder
 
class  Concurrency::task_continuation_context
 The 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...
 
struct  Concurrency::details::_Internal_task_options
 
class  Concurrency::task_options
 Represents the allowed options for creating a task More...
 
struct  Concurrency::details::_ThenImplOptions
 
struct  Concurrency::details::_Task_impl< _ReturnType >
 The implementation of a first-class task. This structure contains the task group used to execute the task function and handles the scheduling. The _Task_impl is created as a shared_ptr member of the public task class, so its destruction is handled automatically. More...
 
struct  Concurrency::details::_Task_ptr< _ReturnType >
 
struct  Concurrency::details::_ContinuationTaskHandleBase
 
struct  Concurrency::details::_TaskEventLogger
 
struct  Concurrency::details::_TaskWorkItemRAIILogger
 
struct  Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >
 The _PPLTaskHandle is the strong-typed task handle base. All user task functions need to be wrapped in this task handler to be executable by PPL. By deriving from a different _BaseTaskHandle, it can be used for both initial tasks and continuation tasks. For initial tasks, _PPLTaskHandle will be derived from _UnrealizedChore_t, and for continuation tasks, it will be derived from _ContinuationTaskHandleBase. The life time of the _PPLTaskHandle object is be managed by runtime if task handle is scheduled. More...
 
struct  Concurrency::details::_Task_impl_base
 The base implementation of a first-class task. This class contains all the non-type specific implementation details of the task. More...
 
struct  Concurrency::details::_Task_impl< _ReturnType >
 The implementation of a first-class task. This structure contains the task group used to execute the task function and handles the scheduling. The _Task_impl is created as a shared_ptr member of the public task class, so its destruction is handled automatically. More...
 
struct  Concurrency::details::_Task_completion_event_impl< _ResultType >
 
class  Concurrency::task_completion_event< _ResultType >
 The 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...
 
class  Concurrency::task_completion_event< void >
 The 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...
 
class  Concurrency::details::_ProgressReporterCtorArgType
 
class  Concurrency::_Continuation_func_transformer< _InpType, _OutType >
 A helper class template that transforms a continuation lambda that either takes or returns void, or both, into a lambda that takes and returns a non-void type (details::_Unit_type is used to substitute for void). This is to minimize the special handling required for 'void'. More...
 
class  Concurrency::_Continuation_func_transformer< void, _OutType >
 
class  Concurrency::_Continuation_func_transformer< _InType, void >
 
class  Concurrency::_Continuation_func_transformer< void, void >
 
class  Concurrency::_Init_func_transformer< _RetType >
 
class  Concurrency::_Init_func_transformer< void >
 
class  Concurrency::task< _ReturnType >
 The Parallel Patterns Library (PPL) 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...
 
struct  Concurrency::task< _ReturnType >::_InitialTaskHandle< _InternalReturnType, _Function, _TypeSelection >
 
struct  Concurrency::task< _ReturnType >::_ContinuationTaskHandle< _InternalReturnType, _ContinuationReturnType, _Function, _IsTaskBased, _TypeSelection >
 The task handle type used to create a 'continuation task'. More...
 
class  Concurrency::task< void >
 The Parallel Patterns Library (PPL) 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...
 
struct  Concurrency::details::_BadArgType
 
struct  Concurrency::details::_TaskTypeFromParam< _Ty >
 

Namespaces

 Concurrency
 The Concurrency namespace provides classes and functions that provide access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.
 
 Concurrency::details
 

Macros

#define _PPLTASKS_H
 
#define _DBG_ONLY(X)
 
#define _PPLTASK_ASYNC_LOGGING   1
 
#define PPL_TASK_SAVE_FRAME_COUNT   1
 
#define _EXPAND_STR(x)   #x
 
#define _CAPTURE_CALLSTACK()   ::Concurrency::details::_TaskCreationCallstack::_CaptureSingleFrameCallstack(_ReturnAddress())
 Helper macro to determine how many stack frames need to be saved. When any number less or equal to 1 is specified, only one frame is captured and no stackwalk will be involved. Otherwise, the number of callstack frames will be captured. More...
 

Typedefs

typedef task_group_status Concurrency::task_status
 A type that represents the terminal state of a task. Valid values are completed and canceled. More...
 
typedef unsigned char Concurrency::details::_Unit_type
 
typedef _TaskCollection_t::_TaskProcHandle_t Concurrency::details::_UnrealizedChore_t
 
typedef std::shared_ptr< _Task_impl_base > Concurrency::details::_Task_ptr_base
 

Functions

template<class _Ty >
_Ty && Concurrency::details::declval ()
 
 Concurrency::__declspec (noreturn) void __cdecl cancel_current_task()
 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 a cancellation request through a cancellation_token, you may also use it by itself, to initiate cancellation of the task that is currently executing. More...
 
template<typename _Ty >
_TypeSelectorAsyncTask Concurrency::details::_AsyncOperationKindSelector (task< _Ty >)
 
_TypeSelectorNoAsync Concurrency::details::_AsyncOperationKindSelector (...)
 
template<typename _Function >
auto Concurrency::details::_IsCallable (_Function _Func, int) -> decltype(_Func(), std::true_type())
 
template<typename _Function >
std::false_type Concurrency::details::_IsCallable (_Function,...)
 
template<typename _Function , typename _Type >
auto Concurrency::details::_ReturnTypeHelper (_Type _Obj, _Function _Func, int, int) -> decltype(_Func(std::declval< task< _Type >>()))
 
template<typename _Function , typename _Type >
auto Concurrency::details::_ReturnTypeHelper (_Type _Obj, _Function _Func, int,...) -> decltype(_Func(_Obj))
 
template<typename _Function , typename _Type >
auto Concurrency::details::_ReturnTypeHelper (_Type _Obj, _Function _Func,...) -> _BadContinuationParamType
 
template<typename _Function , typename _Type >
auto Concurrency::details::_IsTaskHelper (_Type _Obj, _Function _Func, int, int) -> decltype(_Func(std::declval< task< _Type >>()), std::true_type())
 
template<typename _Function , typename _Type >
auto Concurrency::details::_IsTaskHelper (_Type _Obj, _Function _Func, int,...) -> std::false_type
 
template<typename _Function >
auto Concurrency::details::_VoidReturnTypeHelper (_Function _Func, int, int) -> decltype(_Func(std::declval< task< void >>()))
 
template<typename _Function >
auto Concurrency::details::_VoidReturnTypeHelper (_Function _Func, int,...) -> decltype(_Func())
 
template<typename _Function >
auto Concurrency::details::_VoidIsTaskHelper (_Function _Func, int, int) -> decltype(_Func(std::declval< task< void >>()), std::true_type())
 
template<typename _Function >
auto Concurrency::details::_VoidIsTaskHelper (_Function _Func, int,...) -> std::false_type
 
static void Concurrency::details::_ScheduleFuncWithAutoInline (const std::function< void()> &_Func, _TaskInliningMode_t _InliningMode)
 Schedule a functor with automatic inlining. Note that this is "fire and forget" scheduling, which cannot be waited on or canceled after scheduling. This schedule method will perform automatic inlining base on . More...
 
_Internal_task_options & Concurrency::details::_get_internal_task_options (task_options &_Options)
 
const _Internal_task_options & Concurrency::details::_get_internal_task_options (const task_options &_Options)
 
std::function< _Unit_type(void)> Concurrency::details::_MakeVoidToUnitFunc (const std::function< void(void)> &_Func)
 
template<typename _Type >
std::function< _Type(_Unit_type)> Concurrency::details::_MakeUnitToTFunc (const std::function< _Type(void)> &_Func)
 
template<typename _Type >
std::function< _Unit_type(_Type)> Concurrency::details::_MakeTToUnitFunc (const std::function< void(_Type)> &_Func)
 
std::function< _Unit_type(_Unit_type)> Concurrency::details::_MakeUnitToUnitFunc (const std::function< void(void)> &_Func)
 
template<typename _ReturnType , typename _Ty >
auto Concurrency::details::_IsValidTaskCtor (_Ty _Param, int, int, int, int) -> decltype(_Param(), std::true_type())
 
template<typename _ReturnType , typename _Ty >
auto Concurrency::details::_IsValidTaskCtor (_Ty _Param, int, int,...) -> decltype(_Param.set(details::declval< _ReturnType >()), std::true_type())
 
template<typename _ReturnType , typename _Ty >
auto Concurrency::details::_IsValidTaskCtor (_Ty _Param, int,...) -> decltype(_Param.set(), std::true_type())
 
template<typename _ReturnType , typename _Ty >
std::false_type Concurrency::details::_IsValidTaskCtor (_Ty _Param,...)
 
template<typename _ReturnType , typename _Ty >
void Concurrency::details::_ValidateTaskConstructorArgs (const _Ty &_Param)
 
template<typename _Ty >
_Ty Concurrency::details::_GetUnwrappedType (task< _Ty >)
 The following type traits are used for the create_task function. More...
 
template<typename _Ty >
auto Concurrency::details::_GetUnwrappedReturnType (_Ty _Arg, int) -> decltype(_GetUnwrappedType(_Arg))
 
template<typename _Ty >
_Ty Concurrency::details::_GetUnwrappedReturnType (_Ty,...)
 
template<typename _Ty >
_Ty Concurrency::details::_GetTaskType (task_completion_event< _Ty >, std::false_type)
 _GetTaskType functions will retrieve task type T in task[T](Arg), for given constructor argument Arg and its property "callable". It will automatically unwrap argument to get the final return type if necessary. More...
 
template<typename _Ty >
auto Concurrency::details::_GetTaskType (_Ty _NonFunc, std::false_type) -> decltype(_GetUnwrappedType(_NonFunc))
 
template<typename _Ty >
auto Concurrency::details::_GetTaskType (_Ty _Func, std::true_type) -> decltype(_GetUnwrappedReturnType(_Func(), 0))
 
void Concurrency::details::_GetTaskType (std::function< void()>, std::true_type)
 
template<typename _Ty >
auto Concurrency::details::_FilterValidTaskType (_Ty _Param, int) -> decltype(_GetTaskType(_Param, _IsCallable(_Param, 0)))
 
template<typename _Ty >
_BadArgType Concurrency::details::_FilterValidTaskType (_Ty _Param,...)
 
bool Concurrency::details::_IsHRCOMDisconnected (int __hr)
 
template<typename _Ty >
 Concurrency::__declspec (noinline) auto create_task(_Ty _Param
 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. More...
 

Macro Definition Documentation

#define _CAPTURE_CALLSTACK ( )    ::Concurrency::details::_TaskCreationCallstack::_CaptureSingleFrameCallstack(_ReturnAddress())

Helper macro to determine how many stack frames need to be saved. When any number less or equal to 1 is specified, only one frame is captured and no stackwalk will be involved. Otherwise, the number of callstack frames will be captured.

This needs to be defined as a macro rather than a function so that if we're only gathering one frame, _ReturnAddress() will evaluate to client code, rather than a helper function inside of _TaskCreationCallstack, itself.

#define _DBG_ONLY (   X)
#define _EXPAND_STR (   x)    #x
#define _PPLTASK_ASYNC_LOGGING   1
#define _PPLTASKS_H
#define PPL_TASK_SAVE_FRAME_COUNT   1