Skip to content
Snippets Groups Projects
Commit 2c56c013 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'threadpool-setaffinty-care' into 'master'

Only expose pthread_setaffinity_np call when HAVE_SETAFFINITY is defined

Closes #848

See merge request !1687
parents 992ac5f3 c7a3acb0
No related branches found
No related tags found
3 merge requests!1715Update planetary strength after planetary plus's master rebase,!1693More threapool plotting tweaks,!1687Only expose pthread_setaffinity_np call when HAVE_SETAFFINITY is defined
...@@ -44,8 +44,10 @@ ...@@ -44,8 +44,10 @@
static pthread_key_t threadpool_tid; static pthread_key_t threadpool_tid;
/* Affinity mask shared by all threads, and if set. */ /* Affinity mask shared by all threads, and if set. */
#ifdef HAVE_SETAFFINITY
static cpu_set_t thread_affinity; static cpu_set_t thread_affinity;
static int thread_affinity_set = 0; static int thread_affinity_set = 0;
#endif
/* Local declarations. */ /* Local declarations. */
static void threadpool_apply_affinity_mask(void); static void threadpool_apply_affinity_mask(void);
...@@ -446,7 +448,9 @@ void threadpool_set_affinity_mask(cpu_set_t *affinity) { ...@@ -446,7 +448,9 @@ void threadpool_set_affinity_mask(cpu_set_t *affinity) {
* *
*/ */
static void threadpool_apply_affinity_mask(void) { static void threadpool_apply_affinity_mask(void) {
#ifdef HAVE_SETAFFINITY
if (thread_affinity_set) { if (thread_affinity_set) {
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &thread_affinity); pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &thread_affinity);
} }
#endif
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment