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
1398  : _M_pTask(_PTask)
1399  {
1400  }
_Task_ptr< _ReturnType >::_Type _M_pTask
Definition: ppltasks.h:1441
template<typename _ReturnType, typename _DerivedTaskHandle, typename _BaseTaskHandle>
virtual Concurrency::details::_PPLTaskHandle< _ReturnType, _DerivedTaskHandle, _BaseTaskHandle >::~_PPLTaskHandle ( )
inlinevirtual
1403  {
1404  // Here is the sink of all task completion code paths
1405  _M_pTask->_M_taskEventLogger._LogTaskCompleted();
1406  }
_Task_ptr< _ReturnType >::_Type _M_pTask
Definition: ppltasks.h:1441

Member Function Documentation

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