Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Win32 how do you move a thread to another CPU core?

I'd like to make sure that a thread is moved to a specific CPU core and can never be moved from it by the scheduler.

There's a SetThreadAffinityMask() call but there's no GetThreadAffinityMask().

The reason I need this is because high resolution timers will get messed up if the scheduler moves that thread to another CPU.

like image 376
hyperlogic Avatar asked Oct 02 '08 19:10

hyperlogic


1 Answers

You should probably just use SetThreadAffinityMask and trust that it is working.

MSDN

like image 188
Ken Avatar answered Oct 19 '22 23:10

Ken