PDA

View Full Version : Locking all threads to one processor



chuckshaw
3rd July 2007, 19:14
I have a cross platform app that we need to lock all threads to a single processor because of a shared library we are required to use.

In windows we do this by calling :

SetProcessAffinityMask(GetCurrentProcess(), 1);

Does anyone know how I could perform the same action in linux?

Thanks,
Chuck

UPDATE:

well i think i found an answer with sched_setaffinity().