From: Greg V Date: Sun, 16 Sep 2018 16:51:51 +0000 (+0300) Subject: util: fix cpuset support on FreeBSD X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0233372581db739a6996d454d8ef4075e3a147c7;p=mesa.git util: fix cpuset support on FreeBSD Reviewed-by: Eric Engestrom --- 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 ') + 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 +#ifdef PTHREAD_SETAFFINITY_IN_NP_HEADER +#include +#endif +#endif + +#ifdef __FreeBSD__ +#define cpu_set_t cpuset_t #endif static inline thrd_t u_thread_create(int (*routine)(void *), void *param)