X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/54f9d48567e65bd17b9ad3544b5aad57bef54463..a5c102f3397e8112b97c27981bfdbcaac76d79f6:/src/s4u/s4u_Exec.cpp diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index 0cfb0896ab..89f738684c 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -12,12 +12,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_exec, s4u_activity, "S4U asynchronous execut namespace simgrid { namespace s4u { -simgrid::xbt::signal s4u::Exec::on_start; -simgrid::xbt::signal s4u::Exec::on_completion; +xbt::signal Exec::on_start; +xbt::signal Exec::on_completion; Exec::Exec() { - pimpl_ = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl(name_, tracing_category_)); + pimpl_ = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl()); } bool Exec::test() @@ -44,7 +44,7 @@ Exec* Exec::wait() start(); simcall_execution_wait(pimpl_); state_ = State::FINISHED; - on_completion(Actor::self()); + on_completion(*Actor::self()); return this; } @@ -55,7 +55,7 @@ Exec* Exec::wait_for(double) Exec* Exec::cancel() { - simgrid::simix::simcall([this] { boost::static_pointer_cast(pimpl_)->cancel(); }); + simix::simcall([this] { boost::static_pointer_cast(pimpl_)->cancel(); }); state_ = State::CANCELED; return this; } @@ -90,10 +90,10 @@ ExecPtr Exec::set_timeout(double timeout) return this; } -ExecPtr Exec::set_name(std::string name) +ExecPtr Exec::set_name(const std::string& name) { xbt_assert(state_ == State::INITED, "Cannot change the name of an exec after its start"); - name_ = std::move(name); + name_ = name; return this; } @@ -110,10 +110,10 @@ ExecPtr Exec::set_priority(double priority) return this; } -ExecPtr Exec::set_tracing_category(std::string category) +ExecPtr Exec::set_tracing_category(const std::string& category) { xbt_assert(state_ == State::INITED, "Cannot change the tracing category of an exec after its start"); - tracing_category_ = std::move(category); + tracing_category_ = category; return this; } @@ -127,10 +127,13 @@ ExecSeq::ExecSeq(sg_host_t host, double flops_amount) : Exec(), flops_amount_(fl Exec* ExecSeq::start() { simix::simcall([this] { - boost::static_pointer_cast(pimpl_)->start(flops_amount_, 1. / priority_, bound_); + boost::static_pointer_cast(pimpl_) + ->set_name(name_) + ->set_tracing_category(tracing_category_) + ->start(flops_amount_, 1. / priority_, bound_); }); state_ = State::STARTED; - on_start(Actor::self()); + on_start(*Actor::self()); return this; } @@ -191,14 +194,13 @@ Exec* ExecPar::start() boost::static_pointer_cast(pimpl_)->start(hosts_, flops_amounts_, bytes_amounts_); }); state_ = State::STARTED; - on_start(Actor::self()); + on_start(*Actor::self()); return this; } double ExecPar::get_remaining_ratio() { - return simgrid::simix::simcall([this]() { - return boost::static_pointer_cast(pimpl_)->get_par_remaining_ratio(); - }); + return simix::simcall( + [this]() { return boost::static_pointer_cast(pimpl_)->get_par_remaining_ratio(); }); } double ExecPar::get_remaining()