很简单的函数:
比如把当前线程限制在CPU0(第一个processor)上运行:
SetThreadAffinityMask(GetCurrentThread(), 1)
第0位是1
又比如要把当前线程限制在CPU1,CPU2这两个上运行:
SetThreadAffinityMask(GetCurrentThread(), 6)
第1,2位同时为1
If the function succeeds, the return value is the thread's previous affinity mask.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
以前没用过,突然发现,小记下