mdbx: avoid tsan-collision by mdb_env_reader_destr().

Change-Id: Ic87e67db6337e2e1fe1bc21d5e2bbde64b21935b
This commit is contained in:
Leo Yuriev 2016-01-25 15:21:23 +03:00
parent c9c0549b4f
commit 9d14f6a2ac

8
mdb.c
View File

@ -4511,16 +4511,12 @@ static pthread_mutex_t mdb_rthc_lock = PTHREAD_MUTEX_INITIALIZER;
/* LY: TODO: Yet another problem is here - segfault in case if a DSO will
* be unloaded before a thread would been finished. */
static void
mdb_env_reader_destr(void *ptr)
static ATTRIBUTE_NO_SANITIZE_THREAD
void mdb_env_reader_destr(void *ptr)
{
struct MDB_rthc* rthc = ptr;
MDB_reader *reader;
if (! rthc)
/* LY: paranoia */
return;
mdb_ensure(NULL, pthread_mutex_lock(&mdb_rthc_lock) == 0);
reader = rthc->rc_reader;
if (reader && reader->mr_pid == getpid()) {