C++ – On Win32 how do you move a thread to another CPU core

cmulticoremultithreadingwinapi

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.

Best Answer

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

MSDN