diff options
author | Jason Evans <jasone@canonware.com> | 2017-02-09 17:06:22 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2017-02-10 01:05:47 (GMT) |
commit | 7f55dbef9b2a2b93e021d47fa4e6d69c1a633155 (patch) | |
tree | 24be599316f40d60db9749623b2679a550aa8aed /include/jemalloc | |
parent | db7da563595e49fa56cfd2b94cc77fed3d8ac755 (diff) | |
download | jemalloc-7f55dbef9b2a2b93e021d47fa4e6d69c1a633155.zip jemalloc-7f55dbef9b2a2b93e021d47fa4e6d69c1a633155.tar.gz jemalloc-7f55dbef9b2a2b93e021d47fa4e6d69c1a633155.tar.bz2 |
Enable mutex witnesses even when !isthreaded.
This fixes interactions with witness_assert_depth[_to_rank](), which was
added in d0e93ada51e20f4ae394ff4dbdcf96182767c89c (Add
witness_assert_depth[_to_rank]().).
Diffstat (limited to 'include/jemalloc')
-rw-r--r-- | include/jemalloc/internal/mutex_inlines.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/include/jemalloc/internal/mutex_inlines.h b/include/jemalloc/internal/mutex_inlines.h index 0c6c5dd..c0c3cfe 100644 --- a/include/jemalloc/internal/mutex_inlines.h +++ b/include/jemalloc/internal/mutex_inlines.h @@ -11,8 +11,8 @@ void malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex); #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_MUTEX_C_)) JEMALLOC_INLINE void malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex) { + witness_assert_not_owner(tsdn, &mutex->witness); if (isthreaded) { - witness_assert_not_owner(tsdn, &mutex->witness); #ifdef _WIN32 # if _WIN32_WINNT >= 0x0600 AcquireSRWLockExclusive(&mutex->lock); @@ -26,14 +26,14 @@ malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex) { #else pthread_mutex_lock(&mutex->lock); #endif - witness_lock(tsdn, &mutex->witness); } + witness_lock(tsdn, &mutex->witness); } JEMALLOC_INLINE void malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex) { + witness_unlock(tsdn, &mutex->witness); if (isthreaded) { - witness_unlock(tsdn, &mutex->witness); #ifdef _WIN32 # if _WIN32_WINNT >= 0x0600 ReleaseSRWLockExclusive(&mutex->lock); @@ -52,16 +52,12 @@ malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex) { JEMALLOC_INLINE void malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex) { - if (isthreaded) { - witness_assert_owner(tsdn, &mutex->witness); - } + witness_assert_owner(tsdn, &mutex->witness); } JEMALLOC_INLINE void malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex) { - if (isthreaded) { - witness_assert_not_owner(tsdn, &mutex->witness); - } + witness_assert_not_owner(tsdn, &mutex->witness); } #endif |