#include <rtl_sched.h> int pthread_attr_setcpu_np(pthread_attr_t *attr, int cpu); int pthread_attr_getcpu_np(pthread_attr_t *attr, int *cpu);
These functions are non-portable RTLinux extensions. On SMP machines they allow a thread to be scheduled on a specific CPU. The RTLinux scheduler does not try to guess what thread belongs to what CPU. The default processor is the processor where a thread is created, but RTLinux really wants the application to tell it where to run threads.
pthread_attr_setcpu_np modifies the thread attribute object attribute so that the created thread would be scheduled on the CPU with id cpu (as displayed in /proc/cpuinfo). The thread attribute object attr first has to be initialized with pthread_attr_init(3).
pthread_attr_getcpu_np fills the location pointed to by cpu with the CPU id from the attribute structure.
If pthread_attr_setcpu_np was not used on the attribute object passed to pthread_create, the thread is scheduled on the current CPU.
Michael Barabanov (firstname.lastname@example.org)