Restricts the execution resources used by the Concurrency Runtime internal worker threads to the affinity set specified.
It is valid to call this method only before the Resource Manager has been created, or between two Resource Manager lifetimes. It can be invoked multiple times as long as the Resource Manager does not exist at the time of invocation. After an affinity limit has been set, it remains in effect until the next valid call to the set_task_execution_resources method.
The affinity mask provided need not be a subset of the process affinity mask. The process affinity will be updated if necessary.
void __cdecl set_task_execution_resources( DWORD_PTR _ProcessAffinityMask ); void __cdecl set_task_execution_resources( unsigned short _Count, PGROUP_AFFINITY _PGroupAffinity );
The method will throw an invalid_operation exception if a Resource Manager is present at the time it is invoked, and an invalid_argument exception if the affinity specified results in an empty set of resources.
The version of the method that takes an array of group affinities as a parameter should only be used on operating systems with version Windows 7 or higher. Otherwise, an invalid_operation exception is thrown.
Programatically modifying the process affinity after this method has been invoked will not cause the Resource Manager to re-evaluate the affinity it is restricted to. Therefore, all changes to process affinity should be made before calling this method.