Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use activity cancel, not the action cancel
[simgrid.git] / src / kernel / actor / ActorImpl.cpp
index 2c3a48a..8f78d87 100644 (file)
@@ -217,8 +217,7 @@ void ActorImpl::exit()
       if (i != waiting_synchro->simcalls_.end())
         waiting_synchro->simcalls_.remove(&simcall);
     } else if (sleep != nullptr) {
       if (i != waiting_synchro->simcalls_.end())
         waiting_synchro->simcalls_.remove(&simcall);
     } else if (sleep != nullptr) {
-      if (sleep->surf_action_)
-        sleep->surf_action_->cancel();
+      sleep->cancel();
       sleep->post();
     } else if (raw != nullptr) {
       raw->finish();
       sleep->post();
     } else if (raw != nullptr) {
       raw->finish();
@@ -226,8 +225,7 @@ void ActorImpl::exit()
       io->cancel();
     } else {
       simgrid::kernel::activity::ActivityImplPtr activity = waiting_synchro;
       io->cancel();
     } else {
       simgrid::kernel::activity::ActivityImplPtr activity = waiting_synchro;
-      xbt_die("Activity %s is of unknown type %s", activity->get_cname(),
-              simgrid::xbt::demangle(typeid(activity).name()).get());
+      xbt_die("Activity is of unknown type %s", simgrid::xbt::demangle(typeid(activity).name()).get());
     }
 
     waiting_synchro = nullptr;
     }
 
     waiting_synchro = nullptr;
@@ -371,7 +369,9 @@ activity::ActivityImplPtr ActorImpl::suspend(ActorImpl* issuer)
 
     return nullptr;
   } else {
 
     return nullptr;
   } else {
-    return activity::ExecImplPtr(new activity::ExecImpl("suspend", ""))->set_host(host_)->start(0.0, 1.0, 0.0);
+    activity::ExecImpl* exec = new activity::ExecImpl();
+    (*exec).set_name("suspend").set_host(host_).set_flops_amount(0.0).start();
+    return activity::ExecImplPtr(exec);
   }
 }
 
   }
 }
 
@@ -411,11 +411,9 @@ activity::ActivityImplPtr ActorImpl::sleep(double duration)
     throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
         XBT_THROW_POINT, std::string("Host ") + host_->get_cname() + " failed, you cannot sleep there.")));
 
     throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
         XBT_THROW_POINT, std::string("Host ") + host_->get_cname() + " failed, you cannot sleep there.")));
 
-  return activity::SleepImplPtr(new activity::SleepImpl())
-      ->set_name("sleep")
-      ->set_host(host_)
-      ->set_duration(duration)
-      ->start();
+  activity::SleepImpl* sleep = new activity::SleepImpl();
+  (*sleep).set_name("sleep").set_host(host_).set_duration(duration).start();
+  return activity::SleepImplPtr(sleep);
 }
 
 void ActorImpl::throw_exception(std::exception_ptr e)
 }
 
 void ActorImpl::throw_exception(std::exception_ptr e)