Fix malloc_mutex_[un]lock() to conditionally check witness.

Also remove tautological cassert(config_debug) calls.
This commit is contained in:
Jason Evans 2016-04-17 12:53:48 -07:00
parent d9394d0ca8
commit 1b5830178f
2 changed files with 2 additions and 12 deletions

View File

@ -81,6 +81,7 @@ malloc_mutex_lock(tsd_t *tsd, malloc_mutex_t *mutex)
{ {
if (isthreaded) { if (isthreaded) {
if (config_debug)
witness_assert_not_owner(tsd, &mutex->witness); witness_assert_not_owner(tsd, &mutex->witness);
#ifdef _WIN32 #ifdef _WIN32
# if _WIN32_WINNT >= 0x0600 # if _WIN32_WINNT >= 0x0600
@ -103,7 +104,6 @@ malloc_mutex_unlock(tsd_t *tsd, malloc_mutex_t *mutex)
{ {
if (isthreaded) { if (isthreaded) {
witness_assert_owner(tsd, &mutex->witness);
if (config_debug) if (config_debug)
witness_unlock(tsd, &mutex->witness); witness_unlock(tsd, &mutex->witness);
#ifdef _WIN32 #ifdef _WIN32

View File

@ -39,8 +39,6 @@ witness_lock(tsd_t *tsd, witness_t *witness)
witness_list_t *witnesses; witness_list_t *witnesses;
witness_t *w; witness_t *w;
cassert(config_debug);
if (tsd == NULL) if (tsd == NULL)
return; return;
if (witness->rank == WITNESS_RANK_OMIT) if (witness->rank == WITNESS_RANK_OMIT)
@ -63,8 +61,6 @@ witness_unlock(tsd_t *tsd, witness_t *witness)
{ {
witness_list_t *witnesses; witness_list_t *witnesses;
cassert(config_debug);
if (tsd == NULL) if (tsd == NULL)
return; return;
if (witness->rank == WITNESS_RANK_OMIT) if (witness->rank == WITNESS_RANK_OMIT)
@ -101,8 +97,6 @@ witness_assert_owner(tsd_t *tsd, const witness_t *witness)
witness_list_t *witnesses; witness_list_t *witnesses;
witness_t *w; witness_t *w;
cassert(config_debug);
if (tsd == NULL) if (tsd == NULL)
return; return;
if (witness->rank == WITNESS_RANK_OMIT) if (witness->rank == WITNESS_RANK_OMIT)
@ -141,8 +135,6 @@ witness_assert_not_owner(tsd_t *tsd, const witness_t *witness)
witness_list_t *witnesses; witness_list_t *witnesses;
witness_t *w; witness_t *w;
cassert(config_debug);
if (tsd == NULL) if (tsd == NULL)
return; return;
if (witness->rank == WITNESS_RANK_OMIT) if (witness->rank == WITNESS_RANK_OMIT)
@ -184,8 +176,6 @@ witness_assert_lockless(tsd_t *tsd)
witness_list_t *witnesses; witness_list_t *witnesses;
witness_t *w; witness_t *w;
cassert(config_debug);
if (tsd == NULL) if (tsd == NULL)
return; return;