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

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

#include <ppltasks.h>

Inheritance diagram for Concurrency::task_continuation_context:
Concurrency::details::_ContextCallback

Public Member Functions

bool _ForceInline () const
 
- Public Member Functions inherited from Concurrency::details::_ContextCallback
 ~_ContextCallback ()
 
 _ContextCallback (bool _DeferCapture=false)
 
void _Resolve (bool _CaptureCurrent)
 
 _ContextCallback (const _ContextCallback &_Src)
 
 _ContextCallback (_ContextCallback &&_Src)
 
_ContextCallbackoperator= (const _ContextCallback &_Src)
 
_ContextCallbackoperator= (_ContextCallback &&_Src)
 
bool _HasCapturedContext () const
 
bool operator== (const _ContextCallback &_Rhs) const
 
bool operator!= (const _ContextCallback &_Rhs) const
 
_CRTIMP2 void __thiscall _CallInContext (_CallbackFunction _Func, bool _IgnoreDisconnect) const
 
void _CallInContext (_CallbackFunction _Func) const
 

Static Public Member Functions

static task_continuation_context use_default ()
 Creates the default task continuation context. More...
 
static task_continuation_context get_current_winrt_context ()
 Returns a task continuation context object that represents the current winrt thread context. More...
 
static task_continuation_context use_synchronous_execution ()
 Returns a task continuation context object that represents the synchronous execution context. More...
 
- Static Public Member Functions inherited from Concurrency::details::_ContextCallback
static _ContextCallback _CaptureCurrent ()
 

Private Member Functions

_CRTIMP2 __thiscall task_continuation_context ()
 

Private Attributes

bool _M_RunInline
 

Detailed Description

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.

See also
task Class

Constructor & Destructor Documentation

_CRTIMP2 __thiscall Concurrency::task_continuation_context::task_continuation_context ( )
private

Member Function Documentation

bool Concurrency::task_continuation_context::_ForceInline ( ) const
inline
1026  {
1027  return _M_RunInline;
1028  }
bool _M_RunInline
Definition: ppltasks.h:1032
static task_continuation_context Concurrency::task_continuation_context::get_current_winrt_context ( )
inlinestatic

Returns a task continuation context object that represents the current winrt thread context.

Returns
The current winrt thread context.

This method captures the current caller's Windows Runtime thread context. It is very similar to what task_continuation_context::use_current() is doing except it is also available without C++/Cx extension support. Please approach this method with caution as it is designed for advanced users writing C++/Cx agnostic library code. task_continuation_context::use_current() will give you more protection from mistakes.

This method is only available to Windows Store apps.

957  {
958  task_continuation_context _Current;
959  _Current._Resolve(true);
960  return _Current;
961  }
_CRTIMP2 __thiscall task_continuation_context()
static task_continuation_context Concurrency::task_continuation_context::use_default ( )
inlinestatic

Creates the default task continuation context.

Returns
The default continuation context.

The default context is used if you don't specify a continuation context when you call the then method. In Windows applications for Windows 7 and below, as well as desktop applications on Windows 8 and higher, the runtime determines where task continuations will execute. However, in a Windows Store app, the default continuation context for a continuation on an apartment aware task is the apartment where then is invoked.

An apartment aware task is a task that unwraps a Windows Runtime IAsyncInfo interface, or a task that is descended from such a task. Therefore, if you schedule a continuation on an apartment aware task in a Windows Runtime STA, the continuation will execute in that STA.

A continuation on a non-apartment aware task will execute in a context the Runtime chooses.

938  {
939  return task_continuation_context();
940  }
_CRTIMP2 __thiscall task_continuation_context()
static task_continuation_context Concurrency::task_continuation_context::use_synchronous_execution ( )
inlinestatic

Returns a task continuation context object that represents the synchronous execution context.

Returns
The synchronous execution context.

This method will force the continuation task synchronously running on the context causing its antecedent task's completion; if the antecedent task has completed when the continuation is attached, the continuation will synchronously run on the context that attaches the continuation.

1018  {
1019  task_continuation_context _Current;
1020  _Current._Resolve(false);
1021  _Current._M_RunInline = true;
1022  return _Current;
1023  }
_CRTIMP2 __thiscall task_continuation_context()

Member Data Documentation

bool Concurrency::task_continuation_context::_M_RunInline
private

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