23 #if !(defined (_M_X64) || defined (_M_IX86) || defined (_M_ARM) || defined (_M_ARM64))
24 #error ERROR: Concurrency Runtime is supported only on X64, X86, ARM, and ARM64 architectures.
28 #error ERROR: Concurrency Runtime is not supported when compiling /clr.
32 #error ERROR: Concurrency Runtime is supported only for C++.
35 #pragma pack(push,_CRT_PACKING)
44 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
50 class SchedulerPolicy;
63 enum SwitchingProxyState
99 DispatchState() : m_dispatchStateSize(sizeof(DispatchState)), m_fIsPreviousContextAsynchronouslyBlocked(0), m_reserved(0)
107 unsigned long m_dispatchStateSize;
115 unsigned int m_fIsPreviousContextAsynchronouslyBlocked : 1;
122 unsigned int m_reserved : 31;
136 struct IExecutionContext
152 virtual unsigned int GetId()
const =0;
165 virtual IScheduler * GetScheduler() =0;
181 virtual IThreadProxy * GetProxy() =0;
197 virtual void SetProxy(
_Inout_ IThreadProxy * pThreadProxy) =0;
208 virtual void Dispatch(
_Inout_ DispatchState * pDispatchState) =0;
232 virtual unsigned int GetId()
const =0;
279 virtual void SwitchTo(
_Inout_ IExecutionContext * pContext, SwitchingProxyState switchState) =0;
325 virtual void SwitchOut(SwitchingProxyState switchState = Blocking) =0;
340 virtual void YieldToSystem() = 0;
348 enum CriticalRegionType
354 OutsideCriticalRegion,
362 InsideCriticalRegion,
371 InsideHyperCriticalRegion
382 struct IUMSThreadProxy :
public IThreadProxy
394 virtual int EnterCriticalRegion() =0;
404 virtual int ExitCriticalRegion() =0;
420 virtual int EnterHyperCriticalRegion() =0;
430 virtual int ExitHyperCriticalRegion() =0;
441 virtual CriticalRegionType GetCriticalRegionType()
const =0;
460 struct IExecutionResource
476 virtual unsigned int GetNodeId()
const =0;
489 virtual unsigned int GetExecutionResourceId()
const =0;
519 virtual void Remove(
_Inout_ IScheduler * pScheduler) =0;
547 virtual unsigned int CurrentSubscriptionLevel()
const =0;
561 struct IVirtualProcessorRoot :
public IExecutionResource
570 virtual unsigned int GetId()
const =0;
602 virtual void Activate(
_Inout_ IExecutionContext * pContext) =0;
643 virtual bool Deactivate(
_Inout_ IExecutionContext * pContext) =0;
668 virtual void EnsureAllTasksVisible(
_Inout_ IExecutionContext *pContext) =0;
703 virtual unsigned int GetId()
const =0;
733 virtual void Statistics(
_Out_ unsigned int * pTaskCompletionRate,
_Out_ unsigned int * pTaskArrivalRate,
_Out_ unsigned int * pNumberOfTasksEnqueued) =0;
744 virtual SchedulerPolicy GetPolicy()
const =0;
764 virtual void AddVirtualProcessors(
_In_reads_(
count) IVirtualProcessorRoot ** ppVirtualProcessorRoots,
unsigned int count) =0;
789 virtual void RemoveVirtualProcessors(
_In_reads_(
count) IVirtualProcessorRoot ** ppVirtualProcessorRoots,
unsigned int count) =0;
819 virtual void NotifyResourcesExternallyIdle(
_In_reads_(
count) IVirtualProcessorRoot ** ppVirtualProcessorRoots,
unsigned int count) =0;
849 virtual void NotifyResourcesExternallyBusy(
_In_reads_(
count) IVirtualProcessorRoot ** ppVirtualProcessorRoots,
unsigned int count) =0;
860 struct IUMSUnblockNotification
871 virtual IExecutionContext* GetContext() =0;
881 virtual IUMSUnblockNotification* GetNextUnblockNotification() =0;
899 struct IUMSCompletionList
913 virtual IUMSUnblockNotification *GetUnblockNotifications() =0;
939 struct IUMSScheduler :
public IScheduler
955 virtual void SetCompletionList(
_Inout_ IUMSCompletionList * pCompletionList) =0;
970 struct ISchedulerProxy
1005 virtual IExecutionResource * RequestInitialVirtualProcessors(
bool doSubscribeCurrentThread) =0;
1025 virtual void Shutdown() =0;
1043 virtual void BindContext(
_Inout_ IExecutionContext * pContext) =0;
1055 virtual void UnbindContext(
_Inout_ IExecutionContext * pContext) =0;
1076 virtual IExecutionResource * SubscribeCurrentThread() =0;
1095 virtual IVirtualProcessorRoot * CreateOversubscriber(
_Inout_ IExecutionResource * pExecutionResource) =0;
1105 struct ITopologyExecutionResource
1117 virtual ITopologyExecutionResource *GetNext()
const =0;
1126 virtual unsigned int GetId()
const =0;
1136 struct ITopologyNode
1148 virtual ITopologyNode *GetNext()
const =0;
1164 virtual unsigned int GetId()
const =0;
1177 virtual unsigned long GetNumaNode()
const =0;
1187 virtual unsigned int GetExecutionResourceCount()
const =0;
1197 virtual ITopologyExecutionResource *GetFirstExecutionResource()
const =0;
1205 const unsigned int CONCRT_RM_VERSION_1 = 0x00010000;
1220 struct IResourceManager
1230 virtual unsigned int Reference() =0;
1241 virtual unsigned int Release() =0;
1274 virtual ISchedulerProxy *RegisterScheduler(
_Inout_ IScheduler * pScheduler,
unsigned int version) =0;
1283 virtual unsigned int GetAvailableNodeCount()
const =0;
1293 virtual ITopologyNode* GetFirstNode()
const =0;
1318 virtual void CreateNodeTopology(
unsigned int nodeCount,
_In_reads_(nodeCount)
unsigned int * pCoreCount,
_In_reads_opt_(nodeCount)
unsigned int ** pNodeDistance,
_In_reads_(nodeCount)
unsigned int * pProcessorGroups) =0;
1387 _CONCRTIMP IResourceManager* __cdecl CreateResourceManager();
1400 _CONCRTIMP IResourceManager::OSVersion __cdecl GetOSVersion();
1413 _CONCRTIMP unsigned int __cdecl GetSchedulerId();
1426 _CONCRTIMP unsigned int __cdecl GetExecutionContextId();
1439 _CONCRTIMP unsigned int __cdecl GetProcessorCount();
1453 _CONCRTIMP unsigned int __cdecl GetProcessorNodeCount();
#define _Out_
Definition: sal.h:342
The Concurrency namespace provides classes and functions that provide access to the Concurrency Runti...
Definition: agents.h:43
_Iter_diff_t< _InIt > count(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3318
#define _In_reads_opt_(size)
Definition: sal.h:317
#define _CONCRTIMP
Definition: crtdefs.h:48
#define _In_reads_(size)
Definition: sal.h:316
#define _Inout_
Definition: sal.h:375