2011-12-17 28 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);