From 0226150f3bfaf0829cff7b074d5ee8254129dc2c Mon Sep 17 00:00:00 2001 From: tetzank Date: Sun, 13 Oct 2019 22:40:00 +0200 Subject: [PATCH] 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. --- libcoz/ccutil/thread.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libcoz/ccutil/thread.h b/libcoz/ccutil/thread.h index d0f00b6..5ab8989 100644 --- a/libcoz/ccutil/thread.h +++ b/libcoz/ccutil/thread.h @@ -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 +#if !__GLIBC_PREREQ(2,30) + #include static inline pid_t gettid() { @@ -8,3 +13,5 @@ static inline pid_t gettid() { } #endif + +#endif