Proposed Pthread affinity APIs

Joel Sherrill joel.sherrill at
Tue Oct 15 14:29:50 UTC 2013


This is not in the form of a patch yet. I am just throwing
them in a temp .h file locally to compile. These are
the Linux APIs for thread affinity plus get pthread attr.

+ get/set affinity for attr
+ get/set affinity for pthread dynamically
+ get attr for pthread

My plan is to add comparable APIs for get/set
task affinity dynamically to the Classic API.
Probably without the cpusetsize argument.

int pthread_attr_setaffinity_np(
  pthread_attr_t    *attr,
  size_t             cpusetsize,
  const cpu_set_t   *cpuset);

int pthread_attr_getaffinity_np(
  const pthread_attr_t *attr,
  size_t                cpusetsize,
  cpu_set_t            *cpuset

int pthread_getattr_np(
  pthread_t       thread,
  pthread_attr_t *attr

int pthread_setaffinity_np(
  pthread_t         *id,
  size_t             cpusetsize,
  const cpu_set_t   *cpuset);

int pthread_getaffinity_np(
  const pthread_t      *id,
  size_t                cpusetsize,
  cpu_set_t            *cpuset

Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

More information about the devel mailing list