From c7a3acb01d89df374cbe63f76044283819e83c15 Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Fri, 10 Feb 2023 13:38:35 +0000
Subject: [PATCH] Only expose pthread_setaffinity_np call when HAVE_SETAFFINITY
 is defined

---
 src/threadpool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/threadpool.c b/src/threadpool.c
index 5fddd59ae8..85092b5d6a 100644
--- a/src/threadpool.c
+++ b/src/threadpool.c
@@ -44,8 +44,10 @@
 static pthread_key_t threadpool_tid;
 
 /* Affinity mask shared by all threads, and if set. */
+#ifdef HAVE_SETAFFINITY
 static cpu_set_t thread_affinity;
 static int thread_affinity_set = 0;
+#endif
 
 /* Local declarations. */
 static void threadpool_apply_affinity_mask(void);
@@ -446,7 +448,9 @@ void threadpool_set_affinity_mask(cpu_set_t *affinity) {
  *
  */
 static void threadpool_apply_affinity_mask(void) {
+#ifdef HAVE_SETAFFINITY
   if (thread_affinity_set) {
     pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &thread_affinity);
   }
+#endif
 }
-- 
GitLab