strengthen some atomic operations for weak memory models

This commit is contained in:
daan 2019-08-26 08:11:15 -07:00
parent 2159c22415
commit 5c7c106d62
4 changed files with 53 additions and 34 deletions

View file

@ -38,8 +38,8 @@ static void mi_stat_update(mi_stat_count_t* stat, int64_t amount) {
if (mi_is_in_main(stat))
{
// add atomically (for abandoned pages)
int64_t current = mi_atomic_add64(&stat->current,amount);
if (current > stat->peak) stat->peak = stat->current; // racing.. it's ok
mi_atomic_add64(&stat->current,amount);
if (stat->current > stat->peak) stat->peak = stat->current; // racing.. it's ok
if (amount > 0) {
mi_atomic_add64(&stat->allocated,amount);
}