From fe65c122d26f7cb7493bca3a9093eefe5a66717b Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 6 Oct 2020 00:28:12 +0300 Subject: [PATCH] mdbx: fix `pthread_yield()` for non-GLIBC. Change-Id: I080e37a42b62e524896dea8747e9f23e2fcd584f --- src/core.c | 4 +++- src/osal.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index a9ba1ee8..ae2b8e0d 100644 --- a/src/core.c +++ b/src/core.c @@ -777,7 +777,9 @@ static __always_inline void atomic_yield(void) { defined(__mips64__) || defined(_M_MRX000) || defined(_MIPS_) || \ defined(__MWERKS__) || defined(__sgi) __asm__ __volatile__(".word 0x00000140"); -#else +#elif defined(__linux__) || defined(__gnu_linux__) || defined(_UNIX03_SOURCE) + sched_yield(); +#elif (defined(_GNU_SOURCE) && __GLIBC_PREREQ(2, 1)) || defined(_OPEN_THREADS) pthread_yield(); #endif } diff --git a/src/osal.h b/src/osal.h index 3509942d..3af23ce0 100644 --- a/src/osal.h +++ b/src/osal.h @@ -119,6 +119,7 @@ #if defined(__linux__) || defined(__gnu_linux__) #include +#include #include #include #endif /* Linux */