Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake case this bool
[simgrid.git] / src / simix / ActorImpl.cpp
index e0a2043..1b92ac6 100644 (file)
@@ -79,7 +79,8 @@ ActorImplPtr ActorImpl::attach(std::string name, void* data, s4u::Host* host,
 
   if (not host->is_on()) {
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name.c_str(), host->get_cname());
-    return nullptr;
+    std::rethrow_exception(
+        std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Cannot attach actor on failed host.")));
   }
 
   ActorImpl* actor = new ActorImpl(xbt::string(name), host);
@@ -279,7 +280,8 @@ void ActorImpl::yield()
 
   if (suspended_) {
     XBT_DEBUG("Hey! I'm suspended.");
-    xbt_assert(exception_ != nullptr, "Gasp! This exception may be lost by subsequent calls.");
+
+    xbt_assert(exception_ == nullptr, "Gasp! This exception may be lost by subsequent calls.");
     suspended_ = false;
     suspend(this);
   }
@@ -342,7 +344,7 @@ activity::ActivityImplPtr ActorImpl::suspend(ActorImpl* issuer)
 
     return nullptr;
   } else {
-    return activity::ExecImplPtr(new activity::ExecImpl("suspend", "", nullptr, this->host_))->start(0.0, 1.0, 0.0);
+    return activity::ExecImplPtr(new activity::ExecImpl("suspend", "", this->host_))->start(0.0, 1.0, 0.0);
   }
 }
 
@@ -450,7 +452,8 @@ ActorImplPtr ActorImpl::create(std::string name, simix::ActorCode code, void* da
 
   if (not host->is_on()) {
     XBT_WARN("Cannot launch actor '%s' on failed host '%s'", name.c_str(), host->get_cname());
-    return nullptr;
+    std::rethrow_exception(
+        std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Cannot create actor on failed host.")));
   }
 
   ActorImpl* actor = new ActorImpl(simgrid::xbt::string(name), host);