X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a9d6e27d33824900b142bbf5512eb3673a7ece7e..403af5e6247ce6452b721f418a5b41e4548efac4:/src/simix/smx_synchro.cpp diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 78c4935667..6194069658 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -364,14 +364,13 @@ void SIMIX_cond_unref(smx_cond_t cond) void intrusive_ptr_add_ref(s_smx_cond_t *cond) { - auto previous = (cond->refcount_)++; + auto previous = cond->refcount_.fetch_add(1); xbt_assert(previous != 0); } void intrusive_ptr_release(s_smx_cond_t *cond) { - auto count = --(cond->refcount_); - if (count == 0) { + if (cond->refcount_.fetch_sub(1) == 1) { xbt_assert(xbt_swag_size(cond->sleeping) == 0, "Cannot destroy conditional since someone is still using it"); xbt_swag_free(cond->sleeping);