aboutsummaryrefslogtreecommitdiff
path: root/dep/jemalloc/src/mutex.c
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2019-05-05 17:19:10 +0200
committerjackpoz <giacomopoz@gmail.com>2019-05-05 20:05:45 +0200
commit5d986f0be46bf439caf227f3c228ac1c8efddfde (patch)
treee22fcb03f6ba09f9a06b4c577a15fd7e3ff850bc /dep/jemalloc/src/mutex.c
parent6dae4a747da558ca46a777186d4519c32fc1bf04 (diff)
Dep/Jemalloc: Update to Jemalloc 5.2.0
Diffstat (limited to 'dep/jemalloc/src/mutex.c')
-rw-r--r--dep/jemalloc/src/mutex.c9
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;