Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simix::Synchro: Factorize the refcounting for child classes
[simgrid.git] / src / simix / SynchroExec.cpp
index 02ce125..e206b73 100644 (file)
@@ -6,6 +6,11 @@
 #include "src/simix/SynchroExec.hpp"
 #include "src/surf/surf_interface.hpp"
 
+simgrid::simix::Exec::~Exec()
+{
+  if (surf_exec)
+    surf_exec->unref();
+}
 void simgrid::simix::Exec::suspend()
 {
   if (surf_exec)
@@ -25,15 +30,3 @@ double simgrid::simix::Exec::remains()
 
   return 0;
 }
-
-void simgrid::simix::Exec::unref()
-{
-  refcount--;
-  if (refcount > 0)
-    return;
-
-  if (surf_exec)
-    surf_exec->unref();
-
-  delete this;
-}