I'm not sure you can. You can get the process merge mask (GetProcessAffinityMask) and set it (SetProcessAffinityMask). You can also set the thread merge mask, but I understand that in doing so you restrict the thread to work on one of the processors on which your affine mask is installed.
If you delve into specific threads running on specific cores, you probably want to set a process affinity mask to determine the set of cores your code can run on, and threads in your process will then float among the selected cores.
source share