STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Concurrency::details::_CancellationTokenRegistration Class Referenceabstract

#include <pplcancellation_token.h>

Inheritance diagram for Concurrency::details::_CancellationTokenRegistration:
Concurrency::details::_RefCounter Concurrency::details::_CancellationTokenCallback< _Function > Concurrency::details::CancellationTokenRegistration_TaskProc

Public Member Functions

 _CancellationTokenRegistration (long _InitialRefs=1)
 
_CancellationTokenState_GetToken () const
 
- Public Member Functions inherited from Concurrency::details::_RefCounter
virtual ~_RefCounter ()
 
long _Reference ()
 
long _Release ()
 

Protected Member Functions

virtual ~_CancellationTokenRegistration ()
 
virtual void _Exec ()=0
 
- Protected Member Functions inherited from Concurrency::details::_RefCounter
virtual void _Destroy ()
 
 _RefCounter (long _InitialCount=1)
 

Private Member Functions

void _Invoke ()
 

Private Attributes

atomic_long _M_state
 
std::condition_variable _M_CondVar
 
std::mutex _M_Mutex
 
bool _M_signaled
 
_CancellationTokenState_M_pTokenState
 

Static Private Attributes

static const long _STATE_CLEAR = 0
 
static const long _STATE_DEFER_DELETE = 1
 
static const long _STATE_SYNCHRONIZE = 2
 
static const long _STATE_CALLED = 3
 

Friends

class _CancellationTokenState
 

Additional Inherited Members

- Protected Attributes inherited from Concurrency::details::_RefCounter
volatile long _M_refCount
 

Constructor & Destructor Documentation

Concurrency::details::_CancellationTokenRegistration::_CancellationTokenRegistration ( long  _InitialRefs = 1)
inline
117  :
118  _RefCounter(_InitialRefs),
120  _M_signaled(false),
122  {
123  }
static const long _STATE_CALLED
Definition: pplcancellation_token.h:113
atomic_long _M_state
Definition: pplcancellation_token.h:168
bool _M_signaled
Definition: pplcancellation_token.h:171
_CancellationTokenState * _M_pTokenState
Definition: pplcancellation_token.h:172
_RefCounter(long _InitialCount=1)
Definition: pplcancellation_token.h:95
#define NULL
Definition: corecrt.h:158
virtual Concurrency::details::_CancellationTokenRegistration::~_CancellationTokenRegistration ( )
inlineprotectedvirtual
133  {
135  }
atomic_long _M_state
Definition: pplcancellation_token.h:168
#define _ASSERTE(expr)
Definition: crtdbg.h:707
static const long _STATE_CLEAR
Definition: pplcancellation_token.h:110

Member Function Documentation

virtual void Concurrency::details::_CancellationTokenRegistration::_Exec ( )
protectedpure virtual
_CancellationTokenState* Concurrency::details::_CancellationTokenRegistration::_GetToken ( ) const
inline
126  {
127  return _M_pTokenState;
128  }
_CancellationTokenState * _M_pTokenState
Definition: pplcancellation_token.h:172
void Concurrency::details::_CancellationTokenRegistration::_Invoke ( )
inlineprivate
144  {
146  _ASSERTE((_Tid & 0x3) == 0); // If this ever fires, we need a different encoding for this.
147 
149 
150  if (_Result == _STATE_CLEAR)
151  {
152  _Exec();
153 
155 
156  if (_Result == _STATE_SYNCHRONIZE)
157  {
158  {
159  std::lock_guard<std::mutex> _Lock(_M_Mutex);
160  _M_signaled = true;
161  }
162  _M_CondVar.notify_all();
163  }
164  }
165  _Release();
166  }
static const long _STATE_CALLED
Definition: pplcancellation_token.h:113
_CRTIMP2 long __cdecl GetCurrentThreadId()
static const long _STATE_SYNCHRONIZE
Definition: pplcancellation_token.h:112
atomic_long _M_state
Definition: pplcancellation_token.h:168
_T atomic_compare_exchange(std::atomic< _T > &_Target, _T _Exchange, _T _Comparand)
Definition: pplinterface.h:238
std::mutex _M_Mutex
Definition: pplcancellation_token.h:170
std::condition_variable _M_CondVar
Definition: pplcancellation_token.h:169
bool _M_signaled
Definition: pplcancellation_token.h:171
#define _ASSERTE(expr)
Definition: crtdbg.h:707
long _Release()
Definition: pplcancellation_token.h:73
static const long _STATE_CLEAR
Definition: pplcancellation_token.h:110
_Result
Definition: corecrt_wconio.h:362

Friends And Related Function Documentation

friend class _CancellationTokenState
friend

Member Data Documentation

std::condition_variable Concurrency::details::_CancellationTokenRegistration::_M_CondVar
private
std::mutex Concurrency::details::_CancellationTokenRegistration::_M_Mutex
private
_CancellationTokenState* Concurrency::details::_CancellationTokenRegistration::_M_pTokenState
private
bool Concurrency::details::_CancellationTokenRegistration::_M_signaled
private
atomic_long Concurrency::details::_CancellationTokenRegistration::_M_state
private
const long Concurrency::details::_CancellationTokenRegistration::_STATE_CALLED = 3
staticprivate
const long Concurrency::details::_CancellationTokenRegistration::_STATE_CLEAR = 0
staticprivate
const long Concurrency::details::_CancellationTokenRegistration::_STATE_DEFER_DELETE = 1
staticprivate
const long Concurrency::details::_CancellationTokenRegistration::_STATE_SYNCHRONIZE = 2
staticprivate

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