summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg V <[email protected]>2018-09-16 19:51:51 +0300
committerEric Engestrom <[email protected]>2019-08-08 21:44:33 +0100
commit0233372581db739a6996d454d8ef4075e3a147c7 (patch)
tree162f8755e7696dd397510eca8bec41f02dac7528
parentc00ee00031dd38a3c12d6661eba5f43d8a422e02 (diff)
util: fix cpuset support on FreeBSD
Reviewed-by: Eric Engestrom <[email protected]>
-rw-r--r--meson.build6
-rw-r--r--src/util/u_thread.h7
2 files changed, 13 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 06953b364a8..5605b92b05d 100644
--- a/meson.build
+++ b/meson.build
@@ -1143,6 +1143,12 @@ if dep_thread.found() and host_machine.system() != 'windows'
args : '-D_GNU_SOURCE')
pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
endif
+ if cc.has_function(
+ 'pthread_setaffinity_np',
+ dependencies : dep_thread,
+ prefix : '#include <pthread_np.h>')
+ pre_args += '-DPTHREAD_SETAFFINITY_IN_NP_HEADER'
+ endif
endif
dep_expat = dependency('expat')
# this only exists on linux so either this is linux and it will be found, or
diff --git a/src/util/u_thread.h b/src/util/u_thread.h
index 1648d2f5841..c6b35d0814b 100644
--- a/src/util/u_thread.h
+++ b/src/util/u_thread.h
@@ -35,6 +35,13 @@
#ifdef HAVE_PTHREAD
#include <signal.h>
+#ifdef PTHREAD_SETAFFINITY_IN_NP_HEADER
+#include <pthread_np.h>
+#endif
+#endif
+
+#ifdef __FreeBSD__
+#define cpu_set_t cpuset_t
#endif
static inline thrd_t u_thread_create(int (*routine)(void *), void *param)