Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not throw exception in maestro when host->is_off + sleep()
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 26 Aug 2018 09:49:40 +0000 (11:49 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 26 Aug 2018 09:49:46 +0000 (11:49 +0200)
Also, use ActorImpl::throw_exception() instead of messing with its
wannabe private exception_ field.

src/kernel/activity/SleepImpl.cpp
src/simix/ActorImpl.cpp

index 2809eeb..f9c159b 100644 (file)
@@ -37,8 +37,8 @@ void simgrid::kernel::activity::SleepImpl::post()
       /* If the host running the synchro failed, notice it. This way, the asking
        * actor can be killed if it runs on that host itself */
       result = SIMIX_SRC_HOST_FAILURE;
-      simcall->issuer->exception =
-          std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
+      simcall->issuer->throw_exception(
+          std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed")));
     }
 
     switch (surf_sleep->get_state()) {
index dad7703..4ee0c20 100644 (file)
@@ -229,8 +229,8 @@ void ActorImpl::resume()
 smx_activity_t ActorImpl::sleep(double duration)
 {
   if (host_->is_off())
-    throw new simgrid::HostFailureException(XBT_THROW_POINT,
-        std::string("Host ") + std::string(host_->get_cname())+" failed, you cannot sleep there.");
+    throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
+        XBT_THROW_POINT, std::string("Host ") + std::string(host_->get_cname()) + " failed, you cannot sleep there.")));
 
   simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
   synchro->host                                 = host_;
@@ -501,7 +501,7 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
   /* destroy the blocking synchro if any */
   if (process->waiting_synchro != nullptr) {
     if (process->host_->is_off())
-      process->exception = std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
+      process->throw_exception(std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed")));
     simgrid::kernel::activity::ExecImplPtr exec =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(process->waiting_synchro);
     simgrid::kernel::activity::CommImplPtr comm =