Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Fix refcount in Mutex
authorGabriel Corona <gabriel.corona@loria.fr>
Wed, 15 Jun 2016 13:00:04 +0000 (15:00 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Wed, 15 Jun 2016 13:00:04 +0000 (15:00 +0200)
src/simix/smx_synchro_private.h

index 802716a..21e76b4 100644 (file)
@@ -36,13 +36,13 @@ public:
   // boost::intrusive_ptr<Mutex> support:
   friend void intrusive_ptr_add_ref(Mutex* mutex)
   {
-    auto previous = ++mutex->refcount_;
+    auto previous = (mutex->refcount_)++;
     xbt_assert(previous != 0);
     (void) previous;
   }
   friend void intrusive_ptr_release(Mutex* mutex)
   {
-    auto count = mutex->refcount_--;
+    auto count = --(mutex->refcount_);
     if (count == 0)
       delete mutex;
   }