1 // SPDX-License-Identifier: GPL-2.0 << 2 #include <stdint.h> 1 #include <stdint.h> 3 #include <pthread.h> 2 #include <pthread.h> 4 #include <sched.h> 3 #include <sched.h> 5 4 6 int main(void) 5 int main(void) 7 { 6 { 8 int ret = 0; 7 int ret = 0; 9 pthread_attr_t thread_attr; 8 pthread_attr_t thread_attr; 10 cpu_set_t cs; 9 cpu_set_t cs; 11 10 12 pthread_attr_init(&thread_attr); 11 pthread_attr_init(&thread_attr); 13 CPU_ZERO(&cs); 12 CPU_ZERO(&cs); 14 13 15 ret = pthread_attr_setaffinity_np(&thr 14 ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs); 16 15 17 return ret; 16 return ret; 18 } 17 } 19 18
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.