Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
prevent segfault when DEBUG is activated
[simgrid.git] / src / simix / ActorImpl.cpp
index 850e828..e31c9c5 100644 (file)
@@ -16,8 +16,6 @@
 #include "src/mc/mc_replay.hpp"
 #include "src/mc/remote/Client.hpp"
 #include "src/simix/smx_host_private.hpp"
-#include "src/simix/smx_io_private.hpp"
-#include "src/simix/smx_synchro_private.hpp"
 #include "src/surf/HostImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 
@@ -124,7 +122,7 @@ void ActorImpl::exit()
         sleep->surf_action_->cancel();
       sleep->post();
     } else if (raw != nullptr) {
-      SIMIX_synchro_stop_waiting(this, &simcall);
+      raw->finish();
     } else if (io != nullptr) {
       io->cancel();
     } else {
@@ -145,8 +143,8 @@ void ActorImpl::kill(ActorImpl* actor)
     return;
   }
 
-  XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", get_cname(), host_->get_cname(), actor->get_cname(),
-            actor->host_->get_cname());
+  XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", get_cname(), host_ ? host_->get_cname() : "", actor->get_cname(),
+            actor->host_ ? actor->host_->get_cname() : "");
 
   actor->exit();
 
@@ -170,7 +168,7 @@ void ActorImpl::set_kill_time(double kill_time)
   if (kill_time <= SIMIX_get_clock())
     return;
   XBT_DEBUG("Set kill time %f for actor %s@%s", kill_time, get_cname(), host_->get_cname());
-  kill_timer = SIMIX_timer_set(kill_time, [this] {
+  kill_timer = simix::Timer::set(kill_time, [this] {
     this->exit();
     kill_timer = nullptr;
   });
@@ -178,7 +176,7 @@ void ActorImpl::set_kill_time(double kill_time)
 
 double ActorImpl::get_kill_time()
 {
-  return SIMIX_timer_get_date(kill_timer);
+  return kill_timer ? kill_timer->get_date() : 0;
 }
 
 static void dying_daemon(int /*exit_status*/, void* data)
@@ -358,7 +356,7 @@ void ActorImpl::throw_exception(std::exception_ptr e)
 
     activity::RawImplPtr raw = boost::dynamic_pointer_cast<activity::RawImpl>(waiting_synchro);
     if (raw != nullptr) {
-      SIMIX_synchro_stop_waiting(this, &simcall);
+      raw->finish();
     }
 
     activity::IoImplPtr io = boost::dynamic_pointer_cast<activity::IoImpl>(waiting_synchro);
@@ -542,7 +540,7 @@ void SIMIX_process_throw(smx_actor_t actor, xbt_errcat_t cat, int value, const c
     simgrid::kernel::activity::RawImplPtr raw =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::RawImpl>(actor->waiting_synchro);
     if (raw != nullptr) {
-      SIMIX_synchro_stop_waiting(actor, &actor->simcall);
+      raw->finish();
     }
 
     simgrid::kernel::activity::IoImplPtr io =