diff options
author | David Goldblatt <davidgoldblatt@fb.com> | 2017-04-05 01:36:45 (GMT) |
---|---|---|
committer | David Goldblatt <davidtgoldblatt@gmail.com> | 2017-04-05 23:25:37 (GMT) |
commit | 074f2256caecee17b168fe6d7d243a0c6e69a130 (patch) | |
tree | fbe1247aa57ae1fdae351c196de8db225914c73d /src | |
parent | 5dcc13b342b3ffb38a1215ab2584b8cb12c46030 (diff) | |
download | jemalloc-074f2256caecee17b168fe6d7d243a0c6e69a130.zip jemalloc-074f2256caecee17b168fe6d7d243a0c6e69a130.tar.gz jemalloc-074f2256caecee17b168fe6d7d243a0c6e69a130.tar.bz2 |
Make prof's cum_gctx a C11-style atomic
Diffstat (limited to 'src')
-rw-r--r-- | src/prof.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -63,7 +63,7 @@ size_t lg_prof_sample; * creating/destroying mutexes. */ static malloc_mutex_t *gctx_locks; -static unsigned cum_gctxs; /* Atomic counter. */ +static atomic_u_t cum_gctxs; /* Atomic counter. */ /* * Table of mutexes that are shared among tdata's. No operations require @@ -524,7 +524,7 @@ prof_backtrace(prof_bt_t *bt) { static malloc_mutex_t * prof_gctx_mutex_choose(void) { - unsigned ngctxs = atomic_add_u(&cum_gctxs, 1); + unsigned ngctxs = atomic_fetch_add_u(&cum_gctxs, 1, ATOMIC_RELAXED); return &gctx_locks[(ngctxs - 1) % PROF_NCTX_LOCKS]; } |