summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-04-21 22:05:43 (GMT)
committerQi Wang <interwq@gmail.com>2017-04-24 20:23:55 (GMT)
commitf970c497dc5ab2b885d266d59948510c430f8ec1 (patch)
tree93e071eb0f6e9ae372b5e5615c20f55229dd6984 /src
parentaf76f0e5d28cd6f0ce8e6c8c6a2a78ba4089868a (diff)
downloadjemalloc-f970c497dc5ab2b885d266d59948510c430f8ec1.zip
jemalloc-f970c497dc5ab2b885d266d59948510c430f8ec1.tar.gz
jemalloc-f970c497dc5ab2b885d266d59948510c430f8ec1.tar.bz2
Implement malloc_mutex_trylock() w/ proper stats update.
Diffstat (limited to 'src')
-rw-r--r--src/mutex.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mutex.c b/src/mutex.c
index 3bb5ce1..3eec970 100644
--- a/src/mutex.c
+++ b/src/mutex.c
@@ -81,7 +81,7 @@ malloc_mutex_lock_slow(malloc_mutex_t *mutex) {
int cnt = 0, max_cnt = MALLOC_MUTEX_MAX_SPIN;
do {
CPU_SPINWAIT;
- if (!malloc_mutex_trylock(mutex)) {
+ if (!malloc_mutex_trylock_final(mutex)) {
data->n_spin_acquired++;
return;
}
@@ -100,7 +100,7 @@ label_spin_done:
uint32_t n_thds = atomic_fetch_add_u32(&data->n_waiting_thds, 1,
ATOMIC_RELAXED) + 1;
/* One last try as above two calls may take quite some cycles. */
- if (!malloc_mutex_trylock(mutex)) {
+ if (!malloc_mutex_trylock_final(mutex)) {
atomic_fetch_sub_u32(&data->n_waiting_thds, 1, ATOMIC_RELAXED);
data->n_spin_acquired++;
return;