modules: improve _gettid wrapper

- use meson to check for gettid() function, always use if available
- use syscall fallback on linux, if not
- restrict thr_self() fallback to *only* FreeBSD
- error out if there isn't any gettid impl
This commit is contained in:
Érico Nogueira 2021-07-20 12:10:40 -03:00 committed by Wim Taymans
parent a4b8bd6d52
commit 4c166709d0
2 changed files with 9 additions and 2 deletions

View file

@ -254,6 +254,9 @@ endif
if cc.has_function('getpagesize', prefix : '#include<unistd.h>')
cdata.set('HAVE_GETPAGESIZE', 1)
endif
if cc.has_function('gettid', prefix : '#include<unistd.h>', args: [ '-D_GNU_SOURCE' ])
cdata.set('HAVE_GETTID', 1)
endif
if cc.has_function('clock_gettime', prefix : '#include <time.h>')
cdata.set('HAVE_CLOCK_GETTIME', 1)
endif