diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-05-05 17:19:10 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-03 22:02:24 +0100 |
commit | 8dd1f39153df736ad60fb07b50502bb5b03a23fc (patch) | |
tree | 87a99c0d1c89a5f05966ffbfb2c0a9b32a9c486f /dep/jemalloc/src/mutex.c | |
parent | a855e6221d517297cfb9e2e78b57a6a57fccc85a (diff) |
Dep/Jemalloc: Update to Jemalloc 5.2.0
(cherry picked from commit 5d986f0be46bf439caf227f3c228ac1c8efddfde)
Diffstat (limited to 'dep/jemalloc/src/mutex.c')
-rw-r--r-- | dep/jemalloc/src/mutex.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/dep/jemalloc/src/mutex.c b/dep/jemalloc/src/mutex.c index 30222b3e582..3f920f5b1cd 100644 --- a/dep/jemalloc/src/mutex.c +++ b/dep/jemalloc/src/mutex.c @@ -46,7 +46,7 @@ JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, void malloc_mutex_lock_slow(malloc_mutex_t *mutex) { mutex_prof_data_t *data = &mutex->prof_data; - UNUSED nstime_t before = NSTIME_ZERO_INITIALIZER; + nstime_t before = NSTIME_ZERO_INITIALIZER; if (ncpus == 1) { goto label_spin_done; @@ -55,7 +55,8 @@ malloc_mutex_lock_slow(malloc_mutex_t *mutex) { int cnt = 0, max_cnt = MALLOC_MUTEX_MAX_SPIN; do { spin_cpu_spinwait(); - if (!malloc_mutex_trylock_final(mutex)) { + if (!atomic_load_b(&mutex->locked, ATOMIC_RELAXED) + && !malloc_mutex_trylock_final(mutex)) { data->n_spin_acquired++; return; } @@ -144,9 +145,7 @@ malloc_mutex_init(malloc_mutex_t *mutex, const char *name, } # endif #elif (defined(JEMALLOC_OS_UNFAIR_LOCK)) - mutex->lock = OS_UNFAIR_LOCK_INIT; -#elif (defined(JEMALLOC_OSSPIN)) - mutex->lock = 0; + mutex->lock = OS_UNFAIR_LOCK_INIT; #elif (defined(JEMALLOC_MUTEX_INIT_CB)) if (postpone_init) { mutex->postponed_next = postponed_mutexes; |