Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 1 | #include <stdint.h> |
| 2 | #include <pthread.h> |
Adrian Hunter | 543d976 | 2015-03-02 09:59:05 +0200 | [diff] [blame] | 3 | #include <sched.h> |
Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 4 | |
| 5 | int main(void) |
| 6 | { |
| 7 | int ret = 0; |
| 8 | pthread_attr_t thread_attr; |
Adrian Hunter | 95a09cf | 2015-02-24 12:46:06 +0200 | [diff] [blame] | 9 | cpu_set_t cs; |
Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 10 | |
| 11 | pthread_attr_init(&thread_attr); |
Adrian Hunter | 543d976 | 2015-03-02 09:59:05 +0200 | [diff] [blame] | 12 | CPU_ZERO(&cs); |
| 13 | |
Adrian Hunter | 95a09cf | 2015-02-24 12:46:06 +0200 | [diff] [blame] | 14 | ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs); |
Vineet Gupta | 459a3df | 2015-01-13 19:13:24 +0530 | [diff] [blame] | 15 | |
| 16 | return ret; |
| 17 | } |