use own gettid() only for older glibc versions

gettid() is provided in glibc since version 2.30. Detect the glibc version
with a macro and only define our own gettid() when glibc version < 2.30.
This commit is contained in:
tetzank 2019-10-13 22:40:00 +02:00
parent ab9cb71225
commit 0226150f3b

View File

@ -1,6 +1,11 @@
#if !defined(CCUTIL_THREAD_H)
#define CCUTIL_THREAD_H
// gettid() is provided by glibc since version 2.30
// only create our own implementation for older glibc versions
#include <features.h>
#if !__GLIBC_PREREQ(2,30)
#include <sys/syscall.h>
static inline pid_t gettid() {
@ -8,3 +13,5 @@ static inline pid_t gettid() {
}
#endif
#endif