diff options
author | Marek Olšák <[email protected]> | 2018-09-08 21:02:18 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-09-10 14:49:07 -0400 |
commit | 9f1bbbdbbd77d346c74c7abbb31f399151a85713 (patch) | |
tree | c9ec9de878ad9b3e83463f4bc339ad9469b12fef /src | |
parent | 6f00785765cb43b3288e32a6d5d69545cc3b7ef6 (diff) |
util: try to fix the Android and MacOS build
Bionic does not have pthread_setaffinity_np.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107869
Reviewed-by: Jose Fonseca <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/util/u_thread.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util/u_thread.h b/src/util/u_thread.h index ec0d9a7f36f..eee6f3c712d 100644 --- a/src/util/u_thread.h +++ b/src/util/u_thread.h @@ -36,6 +36,9 @@ #include <signal.h> #endif +#if defined(HAVE_PTHREAD) && !defined(ANDROID) && !defined(__APPLE__) +#define HAVE_PTHREAD_SETAFFINITY +#endif static inline thrd_t u_thread_create(int (*routine)(void *), void *param) { @@ -83,7 +86,7 @@ static inline void u_thread_setname( const char *name ) static inline void util_pin_thread_to_L3(thrd_t thread, unsigned L3_index, unsigned cores_per_L3) { -#if defined(HAVE_PTHREAD) +#if defined(HAVE_PTHREAD_SETAFFINITY) cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -103,7 +106,7 @@ util_pin_thread_to_L3(thrd_t thread, unsigned L3_index, unsigned cores_per_L3) static inline int util_get_L3_for_pinned_thread(thrd_t thread, unsigned cores_per_L3) { -#if defined(HAVE_PTHREAD) +#if defined(HAVE_PTHREAD_SETAFFINITY) cpu_set_t cpuset; if (pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset) == 0) { |