diff options
author | Jason Evans <jasone@canonware.com> | 2016-04-17 19:53:48 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-04-17 20:44:59 (GMT) |
commit | 1b5830178fe73d4018233fea6858fff87d2b19df (patch) | |
tree | 13e45bc39e705eada2032baa928d3167894f014a | |
parent | d9394d0ca870fc20b48ee7c57c69d48effe51041 (diff) | |
download | jemalloc-1b5830178fe73d4018233fea6858fff87d2b19df.zip jemalloc-1b5830178fe73d4018233fea6858fff87d2b19df.tar.gz jemalloc-1b5830178fe73d4018233fea6858fff87d2b19df.tar.bz2 |
Fix malloc_mutex_[un]lock() to conditionally check witness.
Also remove tautological cassert(config_debug) calls.
-rw-r--r-- | include/jemalloc/internal/mutex.h | 4 | ||||
-rw-r--r-- | src/witness.c | 10 |
2 files changed, 2 insertions, 12 deletions
diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h index 7d19a0f..581aaf5 100644 --- a/include/jemalloc/internal/mutex.h +++ b/include/jemalloc/internal/mutex.h @@ -81,7 +81,8 @@ malloc_mutex_lock(tsd_t *tsd, malloc_mutex_t *mutex) { if (isthreaded) { - witness_assert_not_owner(tsd, &mutex->witness); + if (config_debug) + witness_assert_not_owner(tsd, &mutex->witness); #ifdef _WIN32 # if _WIN32_WINNT >= 0x0600 AcquireSRWLockExclusive(&mutex->lock); @@ -103,7 +104,6 @@ malloc_mutex_unlock(tsd_t *tsd, malloc_mutex_t *mutex) { if (isthreaded) { - witness_assert_owner(tsd, &mutex->witness); if (config_debug) witness_unlock(tsd, &mutex->witness); #ifdef _WIN32 diff --git a/src/witness.c b/src/witness.c index b7b91ac..444d200 100644 --- a/src/witness.c +++ b/src/witness.c @@ -39,8 +39,6 @@ witness_lock(tsd_t *tsd, witness_t *witness) witness_list_t *witnesses; witness_t *w; - cassert(config_debug); - if (tsd == NULL) return; if (witness->rank == WITNESS_RANK_OMIT) @@ -63,8 +61,6 @@ witness_unlock(tsd_t *tsd, witness_t *witness) { witness_list_t *witnesses; - cassert(config_debug); - if (tsd == NULL) return; 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_t *w; - cassert(config_debug); - if (tsd == NULL) return; 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_t *w; - cassert(config_debug); - if (tsd == NULL) return; if (witness->rank == WITNESS_RANK_OMIT) @@ -184,8 +176,6 @@ witness_assert_lockless(tsd_t *tsd) witness_list_t *witnesses; witness_t *w; - cassert(config_debug); - if (tsd == NULL) return; |