util/u_thread: include pthread_np.h if found

Required for pthread_set_name_np() on OpenBSD as there is no
pthread_setaffinity_np() to define PTHREAD_SETAFFINITY_IN_NP_HEADER.

Fixes: dcf9d91a80 ("util: Handle differences in pthread_setname_np")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5630>
(cherry picked from commit 55765f80b9)
This commit is contained in:
Jonathan Gray 2020-06-24 23:27:52 +10:00 committed by Dylan Baker
parent d37550f8e7
commit 57d65d2f76
3 changed files with 3 additions and 3 deletions

View file

@ -886,7 +886,7 @@
"description": "util/u_thread: include pthread_np.h if found",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "dcf9d91a80ee76f46e162afef9bd1b2ddb53ecc3"
},

View file

@ -1211,7 +1211,7 @@ if not ['linux'].contains(host_machine.system())
endif
endif
foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h', 'pthread_np.h']
if cc.check_header(h)
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
endif

View file

@ -35,7 +35,7 @@
#ifdef HAVE_PTHREAD
#include <signal.h>
#ifdef PTHREAD_SETAFFINITY_IN_NP_HEADER
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
#endif