|
|
@ -238,7 +238,9 @@ typedef SSIZE_T ssize_t; |
|
|
|
#define MDB_OWNERDEAD EOWNERDEAD /**< #LOCK_MUTEX0() result if dead owner */ |
|
|
|
#define MDB_OWNERDEAD EOWNERDEAD /**< #LOCK_MUTEX0() result if dead owner */ |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __GLIBC__ |
|
|
|
|
|
|
|
#define GLIBC_VER ((__GLIBC__ << 16 )| __GLIBC_MINOR__) |
|
|
|
|
|
|
|
#endif |
|
|
|
/** Some platforms define the EOWNERDEAD error code
|
|
|
|
/** Some platforms define the EOWNERDEAD error code
|
|
|
|
* even though they don't support Robust Mutexes. |
|
|
|
* even though they don't support Robust Mutexes. |
|
|
|
* Compile with -DMDB_USE_ROBUST=0, or use some other |
|
|
|
* Compile with -DMDB_USE_ROBUST=0, or use some other |
|
|
@ -248,12 +250,19 @@ typedef SSIZE_T ssize_t; |
|
|
|
* either.) |
|
|
|
* either.) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
#ifndef MDB_USE_ROBUST |
|
|
|
#ifndef MDB_USE_ROBUST |
|
|
|
/* Android currently lacks Robust Mutex support */ |
|
|
|
/* Android currently lacks Robust Mutex support. So does glibc < 2.4. */ |
|
|
|
#if defined(ANDROID) && defined(MDB_USE_POSIX_MUTEX) && !defined(MDB_USE_ROBUST) |
|
|
|
# if defined(MDB_USE_POSIX_MUTEX) && (defined(ANDROID) || \ |
|
|
|
#define MDB_USE_ROBUST 0 |
|
|
|
(defined(__GLIBC__) && GLIBC_VER < 0x020004)) |
|
|
|
#else |
|
|
|
# define MDB_USE_ROBUST 0 |
|
|
|
#define MDB_USE_ROBUST 1 |
|
|
|
# else |
|
|
|
#endif |
|
|
|
# define MDB_USE_ROBUST 1 |
|
|
|
|
|
|
|
/* glibc < 2.10 only provided _np API */ |
|
|
|
|
|
|
|
# if defined(__GLIBC__) && GLIBC_VER < 0x02000a |
|
|
|
|
|
|
|
# define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP |
|
|
|
|
|
|
|
# define pthread_mutexattr_setrobust(attr, flag) pthread_mutexattr_setrobust_np(attr, flag) |
|
|
|
|
|
|
|
# define pthread_mutex_consistent(mutex) pthread_mutex_consistent_np(mutex) |
|
|
|
|
|
|
|
# endif |
|
|
|
|
|
|
|
# endif |
|
|
|
#endif /* MDB_USE_ROBUST */ |
|
|
|
#endif /* MDB_USE_ROBUST */ |
|
|
|
|
|
|
|
|
|
|
|
#if defined(MDB_OWNERDEAD) && MDB_USE_ROBUST |
|
|
|
#if defined(MDB_OWNERDEAD) && MDB_USE_ROBUST |
|
|
|