test-pthread-attr-setaffinity-np.c 271 B

1234567891011121314151617
  1. #include <stdint.h>
  2. #include <pthread.h>
  3. #include <sched.h>
  4. int main(void)
  5. {
  6. int ret = 0;
  7. pthread_attr_t thread_attr;
  8. cpu_set_t cs;
  9. pthread_attr_init(&thread_attr);
  10. CPU_ZERO(&cs);
  11. ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
  12. return ret;
  13. }