Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use only the C++ dtor for Synchro::Raw
[simgrid.git] / src / simix / SynchroRaw.cpp
index e73fe3d..3bb881d 100644 (file)
@@ -5,12 +5,32 @@
 
 #include "src/simix/SynchroRaw.hpp"
 #include "src/surf/surf_interface.hpp"
+#include "src/simix/smx_synchro_private.h"
 
-void simgrid::simix::Raw::suspend() {
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_synchro);
+
+simgrid::simix::Raw::~Raw()
+{
+  sleep->unref();
+}
+void simgrid::simix::Raw::suspend()
+{
   /* The suspension of raw synchros is delayed to when the process is rescheduled. */
 }
 
-void simgrid::simix::Raw::resume() {
+void simgrid::simix::Raw::resume()
+{
   /* I cannot resume raw synchros directly. This is delayed to when the process is rescheduled at
    * the end of the synchro. */
 }
+void simgrid::simix::Raw::post()
+{
+  XBT_IN("(%p)",this);
+  if (sleep->getState() == simgrid::surf::Action::State::failed)
+    state = SIMIX_FAILED;
+  else if(sleep->getState() == simgrid::surf::Action::State::done)
+    state = SIMIX_SRC_TIMEOUT;
+
+  SIMIX_synchro_finish(this);
+  XBT_OUT();
+}