From 9d14f6a2ac9bc4ab14816891427c6b07b8034879 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Mon, 25 Jan 2016 15:21:23 +0300 Subject: [PATCH] mdbx: avoid tsan-collision by mdb_env_reader_destr(). Change-Id: Ic87e67db6337e2e1fe1bc21d5e2bbde64b21935b --- mdb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mdb.c b/mdb.c index 62a2a8fb..d6563b46 100644 --- a/mdb.c +++ b/mdb.c @@ -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()) {