Reference

pthread_attr_setcpu_np(3)

examine and change the CPU pthread attribute

NAME

pthread_attr_setcpu_np, pthread_attr_getcpu_np - examine and change the CPU pthread attribute

SYNOPSIS

#include <rtl_sched.h>

int pthread_sttr_setcpu_np(pthread_attr_t *attr, int cpu); int pthread_sttr_getcpu_np(pthread_attr_t *attr, int *cpu);

DESCRIPTION

These functions are non-portable Real-Time Linux extensions. On SMP machines they allow a thread to be scheduled on a specific CPU.

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_getcpu_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 <[email protected]>

SEE ALSO

pthread_attr_getstacksize(3) pthread_attr_setstacksize(3) pthread_attr_setschedparam(3) pthread_attr_init(3) pthread_attr_getschedparam(3) pthread_create(3)