Commit 5c96fd63 authored by Joanne Hugé's avatar Joanne Hugé

Fix CPU affinity issue

parent c7d63de1
......@@ -53,17 +53,17 @@ static void *timerthread(void *p) {
thread_param_t *param = (thread_param_t *)p;
thread_stat_t *stat = &param->stat;
// Set thread priority
priority.sched_priority = param->priority;
if (sched_setscheduler(0, SCHED_FIFO, &priority))
error(EXIT_FAILURE, errno, "Couldn't set priority");
// Set thread CPU affinity
CPU_ZERO(&mask);
CPU_SET(1, &mask);
if (pthread_setaffinity_np(0, sizeof(mask), &mask) == -1)
if (sched_setaffinity(0, sizeof(mask), &mask))
printf("Could not set CPU affinity to CPU #1\n");
// Set thread priority
priority.sched_priority = param->priority;
if (sched_setscheduler(0, SCHED_FIFO, &priority))
error(EXIT_FAILURE, errno, "Couldn't set priority");
stat->max_res = 0;
stat->min_res = UINT64_MAX;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment