STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Public Attributes | Private Member Functions | List of all members
Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle > Struct Template Reference

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...

#include <ppltasks.h>

Inheritance diagram for Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >:

Public Member Functions

 _PPLTaskHandle (const typename _Task_ptr< _ReturnType >::_Type &_PTask)
 
virtual ~_PPLTaskHandle ()
 
virtual void invoke () const
 
_Task_ptr_base _GetTaskImplBase () const
 

Public Attributes

_Task_ptr< _ReturnType >::_Type _M_pTask
 

Private Member Functions

_PPLTaskHandle const & operator= (_PPLTaskHandle const &)
 

Detailed Description

template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
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.

Template Parameters
_ReturnTypeThe result type of the _Task_impl.
_DerivedTaskHandleThe derived task handle class. The operator () needs to be implemented.
_BaseTaskHandleThe base class from which _PPLTaskHandle should be derived. This is either _UnrealizedChore_t or _ContinuationTaskHandleBase.

Constructor & Destructor Documentation

template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >::_PPLTaskHandle ( const typename _Task_ptr< _ReturnType >::_Type _PTask)
inline
1399  : _M_pTask(_PTask)
1400  {
1401  }
_Task_ptr< _ReturnType >::_Type _M_pTask
Definition: ppltasks.h:1442
template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
virtual Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >::~_PPLTaskHandle ( )
inlinevirtual
1404  {
1405  // Here is the sink of all task completion code paths
1406  _M_pTask->_M_taskEventLogger._LogTaskCompleted();
1407  }
_Task_ptr< _ReturnType >::_Type _M_pTask
Definition: ppltasks.h:1442

Member Function Documentation

template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
_Task_ptr_base Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >::_GetTaskImplBase ( ) const
inline
1438  {
1439  return _M_pTask;
1440  }
_Task_ptr< _ReturnType >::_Type _M_pTask
Definition: ppltasks.h:1442
template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
virtual void Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >::invoke ( ) const
inlinevirtual
1410  {
1411  // All exceptions should be rethrown to finish cleanup of the task collection. They will be caught and handled
1412  // by the runtime.
1413  _ASSERTE((bool)_M_pTask);
1414  if (!_M_pTask->_TransitionedToStarted())
1415  {
1416  static_cast<const _DerivedTaskHandle *>(this)->_SyncCancelAndPropagateException();
1417  return;
1418  }
1419 
1420  _M_pTask->_M_taskEventLogger._LogTaskExecutionStarted();
1421 
1422  _TRY_BEGIN
1423  // All derived task handle must implement this contract function.
1424  static_cast<const _DerivedTaskHandle *>(this)->_Perform();
1425  _CATCH(const task_canceled &)
1426  _M_pTask->_Cancel(true);
1427  _CATCH(const _Interruption_exception &)
1428  _M_pTask->_Cancel(true);
1429  _CATCH_ALL
1430  _M_pTask->_CancelWithException(std::current_exception());
1431  _CATCH_END
1432  _M_pTask->_M_taskEventLogger._LogTaskExecutionCompleted();
1433  }
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH(x)
Definition: xstddef:27
#define _CATCH_END
Definition: xstddef:29
_Task_ptr< _ReturnType >::_Type _M_pTask
Definition: ppltasks.h:1442
STL namespace.
#define _ASSERTE(expr)
Definition: crtdbg.h:707
#define _CATCH_ALL
Definition: xstddef:28
exception_ptr current_exception() _NOEXCEPT
Definition: exception:366
#define true
Definition: stdbool.h:17
template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
_PPLTaskHandle const& Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >::operator= ( _PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle > const &  )
private

Member Data Documentation

template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
_Task_ptr<_ReturnType>::_Type Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >::_M_pTask

The documentation for this struct was generated from the following file: