2011-12-17 21 views

回答

1

好吧,我要假设你想要亲和力。 SetThreadAffinityMask的第二个参数是表示线程被允许运行在哪些处理器上的位掩码。这些位在相应的处理器上设置为1。例如:

// binary 01, so it allows this thread to run on CPU 0 
SetThreadAffinityMask(hThread, 0x01); 
// binary 10, so it allows this thread to run on CPU 1 
SetThreadAffinityMask(hThread, 0x02); 
// binary 11, so it allows this thread to run on CPU 0 or CPU 1 
SetThreadAffinityMask(hThread, 0x03);