Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
first step towards asynchronous executions
[simgrid.git] / src / s4u / s4u_actor.cpp
index ddb8fac..be0a900 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "simgrid/s4u/Actor.hpp"
 #include "simgrid/s4u/Comm.hpp"
+#include "simgrid/s4u/Exec.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Mailbox.hpp"
 
@@ -61,6 +62,11 @@ void Actor::join() {
   simcall_process_join(this->pimpl_, -1);
 }
 
+void Actor::join(double timeout)
+{
+  simcall_process_join(this->pimpl_, timeout);
+}
+
 void Actor::setAutoRestart(bool autorestart) {
   simgrid::simix::kernelImmediate([this, autorestart]() { pimpl_->auto_restart = autorestart; });
 }
@@ -194,6 +200,22 @@ Actor* Actor::restart()
   return simgrid::simix::kernelImmediate([this]() { return pimpl_->restart(); });
 }
 
+ExecPtr Actor::exec_init(double flops_amount)
+{
+  ExecPtr res        = ExecPtr(new Exec());
+  res->runner_       = SIMIX_process_self();
+  res->flops_amount_ = flops_amount;
+  res->setRemains(flops_amount);
+  return res;
+}
+
+ExecPtr Actor::exec_async(double flops)
+{
+  ExecPtr res = exec_init(flops);
+  res->start();
+  return res;
+}
+
 // ***** this_actor *****
 
 namespace this_actor {