mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 16:34:14 +08:00
mdbx: backport - ITS#8339 Solaris 10/11 robust mutex fixes.
Check for PTHREAD_MUTEX_ROBUST_NP definition (this doesn't work on Linux/glibc because they used an enum). Zero out mutex before initing. Change-Id: Ic618a6a72fbd7680dd76d5fd0aef06545dcba994
This commit is contained in:
parent
3deb4577fb
commit
2806453b54
8
mdb.c
8
mdb.c
@ -4815,8 +4815,14 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
|
||||
return errno;
|
||||
|
||||
if (*excl > 0) {
|
||||
pthread_mutexattr_t mattr;
|
||||
/* Solaris needs this before initing a robust mutex. Otherwise
|
||||
* it may skip the init and return EBUSY "seems someone already
|
||||
* inited" or EINVAL "it was inited differently".
|
||||
*/
|
||||
memset(&env->me_txns->mti_rmutex, 0, sizeof(env->me_txns->mti_rmutex));
|
||||
memset(&env->me_txns->mti_wmutex, 0, sizeof(env->me_txns->mti_wmutex));
|
||||
|
||||
pthread_mutexattr_t mattr;
|
||||
if ((rc = pthread_mutexattr_init(&mattr))
|
||||
|| (rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED))
|
||||
#if MDB_USE_ROBUST
|
||||
|
Loading…
x
Reference in New Issue
Block a user