Created
January 29, 2018 13:57
-
-
Save raw-bin/e93942f82fc6bab317e955662764c673 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 int set_affinity_to_cpu(int cpu) | |
1 { | |
2 cpu_set_t cpu_mask; | |
3 int status; | |
4 | |
5 CPU_ZERO(&cpu_mask); | |
6 CPU_SET(cpu, &cpu_mask); | |
7 | |
8 status = sched_setaffinity(0, sizeof(cpu_mask), &cpu_mask); | |
9 if (status) | |
10 return 1; | |
11 else | |
12 return 0; | |
13 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment