mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-01 23:34:13 +08:00
mdbx: avoid tsan-trap in mdb_txn_renew0() by me_live_reader.
Change-Id: I70f173d3e77c9cc84881c86e8fc64ae2a4906f0b
This commit is contained in:
parent
f38bb9621f
commit
24449c2a07
17
mdb.c
17
mdb.c
@ -2773,16 +2773,19 @@ mdb_txn_renew0(MDB_txn *txn, unsigned flags)
|
||||
pthread_t tid = pthread_self();
|
||||
pthread_mutex_t *rmutex = MDB_MUTEX(env, r);
|
||||
|
||||
if (unlikely(!env->me_live_reader)) {
|
||||
rc = mdb_reader_pid(env, F_SETLK, pid);
|
||||
if (unlikely(rc != MDB_SUCCESS))
|
||||
return rc;
|
||||
env->me_live_reader = 1;
|
||||
}
|
||||
|
||||
rc = mdb_mutex_lock(env, rmutex);
|
||||
if (unlikely(rc != MDB_SUCCESS))
|
||||
return rc;
|
||||
|
||||
if (unlikely(!env->me_live_reader)) {
|
||||
rc = mdb_reader_pid(env, F_SETLK, pid);
|
||||
if (unlikely(rc != MDB_SUCCESS)) {
|
||||
mdb_mutex_unlock(env, rmutex);
|
||||
return rc;
|
||||
}
|
||||
env->me_live_reader = 1;
|
||||
}
|
||||
|
||||
nr = env->me_txns->mti_numreaders;
|
||||
for (i=0; i<nr; i++)
|
||||
if (env->me_txns->mti_readers[i].mr_pid == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user