Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Avoid useless mutex increment
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 20 Jun 2016 10:25:22 +0000 (12:25 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 20 Jun 2016 10:25:22 +0000 (12:25 +0200)
src/simix/smx_synchro.cpp

index 2d20719..c8ec7fe 100644 (file)
@@ -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;
 }