X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/315c1504ff4aec5188611d052a65c97aec85cd92..1c2027adbae4b33dae8f25289085ec4bdf3e1691:/src/s4u/s4u_actor.cpp diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index ddb8fac0cf..be0a900a26 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -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 {