Commit 9f8421af authored by Jan Beich's avatar Jan Beich
Browse files

meson: check pthread_setname_np like autotools

FreeBSD < 12.2 and OpenBSD only have pthread_set_name_np.
As libpthread isn't in scope use -Werror to trip the check.

Header <pthread.h> has symbol "PTHREAD_MUTEX_RECURSIVE" : YES
Checking if "pthread_setname_np(tid, name)" compiles: YES

os/inputthread.c:326:5: error: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pthread_setname_np (pthread_self(), "InputThread");
    ^
os/inputthread.c:447:5: error: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pthread_setname_np (pthread_self(), "MainThread");
    ^

Fixes: c20e7b5e ("meson: Automatically detect HAVE_PTHREAD_SETNAME_NP")
parent 38e87590
Pipeline #298346 passed with stages
in 7 minutes and 39 seconds
......@@ -67,6 +67,7 @@ if cc.compiles('''
#include <pthread.h>
void foo(int bar) { pthread_setname_np(pthread_self(), "example"); }
''',
args: '-Werror-implicit-function-declaration',
name: 'pthread_setname_np(tid, name)')
conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITH_TID', 1)
elif cc.compiles('''
......@@ -74,6 +75,7 @@ elif cc.compiles('''
#include <pthread.h>
void foo(int bar) { pthread_setname_np("example"); }
''',
args: '-Werror-implicit-function-declaration',
name: 'pthread_setname_np(name)')
conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', 1)
endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment