From 6cc42173cbb2dad6ef5c7e49e6666987ce4cf92c Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Fri, 20 Sep 2024 20:33:10 -0700 Subject: [PATCH] Assert the mutex is locked within malloc_mutex_assert_owner(). --- include/jemalloc/internal/mutex.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h index ceb07b85..db2bdf37 100644 --- a/include/jemalloc/internal/mutex.h +++ b/include/jemalloc/internal/mutex.h @@ -250,6 +250,9 @@ malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex) { static inline void malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex) { witness_assert_owner(tsdn_witness_tsdp_get(tsdn), &mutex->witness); + if (isthreaded) { + assert(malloc_mutex_is_locked(mutex)); + } } static inline void