Fix tabbing.... Please fix your editors so they do tabbing correctly!!! (Spaces...
[IRC.git] / Robust / src / Runtime / affinity.h
1 #ifndef AFFINITY_H
2 #define AFFINITY_H
3 #include <sys/syscall.h>
4 #include <sched.h>
5 #include <errno.h>
6
7 static void set_affinity(unsigned long cpu) {
8   int err;
9   cpu_set_t cpumask;
10
11   CPU_ZERO(&cpumask);
12   CPU_SET(cpu, &cpumask);
13   err = sched_setaffinity(syscall(SYS_gettid),
14                           sizeof(cpu_set_t), &cpumask);
15
16   if (err == -1)
17     printf("set_affinity: %s\n", strerror(errno));
18 }
19 #endif