[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: RE24 testing call #3 (2.4.43) LMDB RE0.9 testing call #3 (0.9.17)
Aaron Richton wrote:
On Tue, 10 Nov 2015, Cl?ment OUDOT wrote:
Could it be a problem on my build machine?
Not directly IMO. Some (older?) pthreads implementations are
PTHREAD_MUTEX_ROBUST_NP, etc.
one thing to try would be:
#ifdef PTHREAD_MUTEX_ROBUST_NP
#define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP
#define pthread_mutexattr_setrobust pthread_mutexattr_setrobust_np
#define pthread_mutex_consistent pthread_mutex_consistent_np
#endif
Unfortunately, PTHREAD_MUTEX_ROBUST_NP is an enum, not a macro, so #ifdef
won't work to detect it.
The attached patch should work. Please report back; I won't merge it unless we
know it actually helps.
which might also need:
|| (rc = pthread_mutexattr_setrobust(&mattr,
PTHREAD_MUTEX_ROBUST))
+ || (rc = pthread_mutexattr_setprotocol(&mattr,
PTHREAD_PRIO_INHERIT))
|| (rc =
pthread_mutex_init(env->me_txns->mti_rmutex, &mattr))
or you can just -DMDB_USE_ROBUST=0, but I don't think the platform is *that*
hopeless...
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
commit 19dc79812b2bdb803bd2e68e15b7a48d6e19c2fa
Author: Howard Chu <hyc@openldap.org>
Date: Wed Nov 11 00:02:06 2015 +0000
Tweak robust mutex detection for glibc
diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c
index 6d9e0a4..b66916c 100644
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -262,12 +262,19 @@ union semun {
* either.)
*/
#ifndef MDB_USE_ROBUST
-/* Android currently lacks Robust Mutex support */
-#if defined(ANDROID) && defined(MDB_USE_POSIX_MUTEX) && !defined(MDB_USE_ROBUST)
-#define MDB_USE_ROBUST 0
-#else
-#define MDB_USE_ROBUST 1
-#endif
+/* Android currently lacks Robust Mutex support. So does glibc < 2.4. */
+# if defined(MDB_USE_POSIX_MUTEX) && (defined(ANDROID) || \
+ (defined(__GLIBC__) && !__GLIBC_PREREQ(2, 4)))
+# define MDB_USE_ROBUST 0
+# else
+# define MDB_USE_ROBUST 1
+/* glibc < 2.10 only provided _np API */
+# if !__GLIBC_PREREQ(2, 10)
+# 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 */
#if defined(MDB_OWNERDEAD) && MDB_USE_ROBUST