Skip to content

Commit

Permalink
fix compile error on platforms without pthread_setaffinity_np
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Apr 15, 2019
1 parent ab3d087 commit a957a63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,7 @@ H2O_NORETURN static void *run_loop(void *_thread_index)
conf.threads[thread_index].tid = pthread_self();

if (conf.thread_map.entries[thread_index] >= 0) {
#ifdef H2O_HAS_PTHREAD_SETAFFINITY_NP
cpu_set_t cpu_set;
CPU_ZERO(&cpu_set);
CPU_SET(conf.thread_map.entries[thread_index], &cpu_set);
Expand All @@ -1689,6 +1690,9 @@ H2O_NORETURN static void *run_loop(void *_thread_index)
fprintf(stderr, "[warning] failed to set bind to CPU:%d\n", conf.thread_map.entries[thread_index]);
}
}
#else
h2o_fatal("internal error; thread pinning not available even though specified");
#endif
}

/* setup listeners */
Expand Down

0 comments on commit a957a63

Please sign in to comment.