From: Gabriel Corona Date: Mon, 20 Jun 2016 10:25:22 +0000 (+0200) Subject: [simix] Avoid useless mutex increment X-Git-Tag: v3_14~938 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dad27a3ba1ef33904b668c45a9f876a0115d5848?hp=7c320b28e7e4c308714f336a2b4043165a955440 [simix] Avoid useless mutex increment --- diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 2d20719e85..c8ec7fe32c 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -240,8 +240,7 @@ smx_cond_t SIMIX_cond_init(void) smx_cond_t cond = xbt_new0(s_smx_cond_t, 1); cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup)); cond->mutex = nullptr; - cond->refcount_ = 0; - intrusive_ptr_add_ref(cond); + cond->refcount_ = 1; XBT_OUT(); return cond; } @@ -373,6 +372,7 @@ void SIMIX_cond_unref(smx_cond_t cond) void intrusive_ptr_add_ref(s_smx_cond_t *cond) { auto previous = (cond->refcount_)++; + xbt_assert(previous != 0); (void) previous; }