man pthread_attr_setcpu_np () - examine and change the CPU pthread attribute
NAME
pthread_attr_setcpu_np, pthread_attr_getcpu_nppthread_attr_getcpu_np - examine and change the CPU pthread attribute
SYNOPSIS
#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);
DESCRIPTION
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.
RETURN VALUE
All functions return 0 on success and a non-zero error code on error.
ERRORS
pthread_attr_setcpu_np returns EINVAL if the specified CPU does not exist in the system.
NOTES
If pthread_attr_setcpu_np was not used on the attribute object passed to pthread_create, the thread is scheduled on the current CPU.
AUTHOR
Michael Barabanov (baraban@fsmlabs.com (link to URL mailto:baraban@fsmlabs.com) )
SEE ALSO
UNIX spec pthread_attr_getstacksize(3) (link to URL ../susv2/xsh/pthread_attr_getstacksize.html) , UNIX spec pthread_attr_setstacksize(3) (link to URL ../susv2/xsh/pthread_attr_setstacksize.html) , UNIX spec pthread_attr_setschedparam(3) (link to URL ../susv2/xsh/pthread_attr_setschedparam.html) , UNIX spec pthread_attr_init(3) (link to URL ../susv2/xsh/pthread_attr_init.html) , UNIX spec pthread_attr_getschedparam(3) (link to URL ../susv2/xsh/pthread_attr_getschedparam.html) , UNIX spec pthread_create(3) (link to URL ../susv2/xsh/pthread_create.html)
©2001 FSMLabs Inc.
All rights reserved.