Forcing thread to run on specific processor
I am trying to run my threads on specified cores.
hThreads = (HANDLE)_beginthread(threadn,0,NULL);
hThreads = (HANDLE)_beginthread(threadm,0,NULL);
I have some basic code, two threads, of which the second I want to run on a specific core.
So I used "SetThreadAffinityMask" which is specifically for this as I understand.
But for some reason it doesn't run it on the specific core but instead spreads it over the cpu1-3. (hthread0 doesn't do much so it can't use any resources).
Is there anything else I should do/use to make it work?
2. Can I use "SetThreadAffinityMask" with pthreads as well?
3. If it were to work, and I would spawn say 10 threads on hthread1 would they all stay on the same core or would they be spread over all cores?