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