From: Howard Chu Date: Sat, 31 Oct 2015 02:11:47 +0000 (+0000) Subject: Add MDB_NO_ROBUST to disable Robust Mutexes X-Git-Tag: LMDB_0.9.17~56 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=447f552756c4e388aca2789ffe56043f4c412fd2;p=openldap Add MDB_NO_ROBUST to disable Robust Mutexes --- diff --git a/libraries/liblmdb/Makefile b/libraries/liblmdb/Makefile index 62b52a9ad1..afd0cd8cc8 100644 --- a/libraries/liblmdb/Makefile +++ b/libraries/liblmdb/Makefile @@ -13,6 +13,7 @@ # - MDB_FDATASYNC # - MDB_FDATASYNC_WORKS # - MDB_USE_PWRITEV +# - MDB_NO_ROBUST # # There may be other macros in mdb.c of interest. You should # read mdb.c before changing any of them. diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 7a21b50ef5..ac3ec2b640 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -238,7 +238,25 @@ typedef SSIZE_T ssize_t; #define MDB_OWNERDEAD EOWNERDEAD /**< #LOCK_MUTEX0() result if dead owner */ #endif -#ifdef MDB_OWNERDEAD +/* Android currently lacks Robust Mutex support */ +#if defined(ANDROID) && defined(MDB_USE_POSIX_MUTEX) +#define MDB_NO_ROBUST 1 +#endif + +/** Some platforms define the EOWNERDEAD error code + * even though they don't support Robust Mutexes. + * Compile with -DMDB_NO_ROBUST, or use some other + * mechanism like -DMDB_USE_SYSV_SEM instead of + * -DMDB_USE_POSIX_MUTEX. (SysV semaphores are + * also Robust, but some systems don't support them + * either.) + */ + +#ifndef MDB_NO_ROBUST +#define MDB_NO_ROBUST 0 +#endif + +#if defined(MDB_OWNERDEAD) && !(MDB_NO_ROBUST) #define MDB_ROBUST_SUPPORTED 1 #endif