From: bdemsky Date: Wed, 17 Nov 2010 07:27:23 +0000 (+0000) Subject: affinity call X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e98aa0573f982ff794415a3a4081fdd2a70965d3;p=IRC.git affinity call --- diff --git a/Robust/src/Runtime/affinity.h b/Robust/src/Runtime/affinity.h new file mode 100644 index 00000000..1834d7b4 --- /dev/null +++ b/Robust/src/Runtime/affinity.h @@ -0,0 +1,16 @@ +#ifndef AFFINITY_H +#define AFFINITY_H + +static void set_affinity(unsigned long cpu) { + int err; + cpu_set_t cpumask; + + CPU_ZERO(&cpumask); + CPU_SET(cpu, &cpumask); + err = sched_setaffinity(syscall(SYS_gettid), + sizeof(cpu_set_t), &cpumask); + + if (err == -1) + printf("set_affinity: %s\n", strerror(errno)); +} +#endif