STLdoc
STLdocumentation
|
The task_handle
class represents an individual parallel work item. It encapsulates the instructions and the data required to execute a piece of work.
More...
#include <ppl.h>
Public Member Functions | |
task_handle (const _Function &_Func) | |
Constructs a new task_handle object. The work of the task is performed by invoking the function specified as a parameter to the constructor. More... | |
~task_handle () | |
Destroys the task_handle object. More... | |
void | operator() () const |
The function call operator that the runtime invokes to perform the work of the task handle. More... | |
Public Member Functions inherited from Concurrency::details::_UnrealizedChore | |
_UnrealizedChore () | |
virtual | ~_UnrealizedChore () |
void | _Invoke () |
void | _SetDetached (bool _FDetached) |
::Concurrency::details::_TaskCollectionBase * | _OwningCollection () const |
void | _SetRuntimeOwnsLifetime (bool _FValue) |
bool | _GetRuntimeOwnsLifetime () const |
void | _PrepareSteal (ContextBase *_PContext) |
Public Member Functions inherited from Concurrency::details::_AllocBase | |
void * | operator new (size_t _Size) |
void | operator delete (void *_Ptr) throw () |
void * | operator new (size_t _Size, const std::nothrow_t &) throw () |
void | operator delete (void *_Ptr, const std::nothrow_t &) throw () |
void * | operator new[] (size_t _Size) |
void | operator delete[] (void *_Ptr) throw () |
void * | operator new[] (size_t _Size, const std::nothrow_t &_No_throw) throw () |
void | operator delete[] (void *_Ptr, const std::nothrow_t &_No_throw) throw () |
void * | operator new (size_t, void *_Location) throw () |
void | operator delete (void *, void *) throw () |
void *__cdecl | operator new[] (size_t, void *_Location) throw () |
void __cdecl | operator delete[] (void *, void *) throw () |
Private Member Functions | |
task_handle const & | operator= (task_handle const &) |
Private Attributes | |
_Function | _M_function |
Friends | |
class | task_group |
class | structured_task_group |
Additional Inherited Members | |
Static Public Member Functions inherited from Concurrency::details::_UnrealizedChore | |
template<typename _ChoreType , typename _Function > | |
static _ChoreType * | _InternalAlloc (const _Function &_Func) |
Public Attributes inherited from Concurrency::details::_Chore | |
TaskProc | m_pFunction |
Protected Member Functions inherited from Concurrency::details::_UnrealizedChore | |
_CONCRTIMP void | _CheckTaskCollection () |
Protected Member Functions inherited from Concurrency::details::_Chore | |
_Chore (TaskProc _PFunction) | |
_Chore () | |
virtual | ~_Chore () |
Static Protected Member Functions inherited from Concurrency::details::_UnrealizedChore | |
template<typename _ChoreType > | |
static void __cdecl | _InvokeBridge (void *_PContext) |
The task_handle
class represents an individual parallel work item. It encapsulates the instructions and the data required to execute a piece of work.
_Function | The type of the function object that will be invoked to execute the work represented by the task_handle object. |
task_handle
objects can be used in conjunction with a structured_task_group
or a more general task_group
object, to decompose work into parallel tasks. For more information, see Task Parallelism.
Note that the creator of a task_handle
object is responsible for maintaining the lifetime of the created task_handle
object until it is no longer required by the Concurrency Runtime. Typically, this means that the task_handle
object must not destruct until either the wait
or run_and_wait
method of the task_group
or structured_task_group
to which it is queued has been called.
task_handle
objects are typically used in conjunction with C++ lambdas. Because you do not know the true type of the lambda, the make_task function is typically used to create a task_handle
object.
The runtime creates a copy of the work function that you pass to a task_handle
object. Therefore, any state changes that occur in a function object that you pass to a task_handle
object will not appear in your copy of that function object.
|
inline |
Constructs a new task_handle
object. The work of the task is performed by invoking the function specified as a parameter to the constructor.
_Func | The function that will be invoked to execute the work represented by the task_handle object. This may be a lambda functor, a pointer to a function, or any object that supports a version of the function call operator with the signature void operator()() . |
The runtime creates a copy of the work function that you pass to the constructor. Therefore, any state changes that occur in a function object that you pass to a task_handle
object will not appear in your copy of that function object.
|
inline |
Destroys the task_handle
object.
|
inline |
The function call operator that the runtime invokes to perform the work of the task handle.
|
private |
|
friend |
|
friend |
|
private |