Enable mutex witnesses even when !isthreaded.
This fixes interactions with witness_assert_depth[_to_rank](), which was
added in dad74bd3c8
(Convert
witness_assert_lockless() to witness_assert_lock_depth().).
This commit is contained in:
parent
44e50041dc
commit
7034e6baa1
@ -85,8 +85,8 @@ JEMALLOC_INLINE void
|
|||||||
malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex)
|
malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
witness_assert_not_owner(tsdn, &mutex->witness);
|
||||||
if (isthreaded) {
|
if (isthreaded) {
|
||||||
witness_assert_not_owner(tsdn, &mutex->witness);
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# if _WIN32_WINNT >= 0x0600
|
# if _WIN32_WINNT >= 0x0600
|
||||||
AcquireSRWLockExclusive(&mutex->lock);
|
AcquireSRWLockExclusive(&mutex->lock);
|
||||||
@ -100,16 +100,16 @@ malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex)
|
|||||||
#else
|
#else
|
||||||
pthread_mutex_lock(&mutex->lock);
|
pthread_mutex_lock(&mutex->lock);
|
||||||
#endif
|
#endif
|
||||||
witness_lock(tsdn, &mutex->witness);
|
|
||||||
}
|
}
|
||||||
|
witness_lock(tsdn, &mutex->witness);
|
||||||
}
|
}
|
||||||
|
|
||||||
JEMALLOC_INLINE void
|
JEMALLOC_INLINE void
|
||||||
malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex)
|
malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
witness_unlock(tsdn, &mutex->witness);
|
||||||
if (isthreaded) {
|
if (isthreaded) {
|
||||||
witness_unlock(tsdn, &mutex->witness);
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# if _WIN32_WINNT >= 0x0600
|
# if _WIN32_WINNT >= 0x0600
|
||||||
ReleaseSRWLockExclusive(&mutex->lock);
|
ReleaseSRWLockExclusive(&mutex->lock);
|
||||||
@ -130,16 +130,14 @@ JEMALLOC_INLINE void
|
|||||||
malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex)
|
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
|
JEMALLOC_INLINE void
|
||||||
malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex)
|
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
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user