X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2cf13759ba1696d88f5ff86afee5324f30ccdbfc..c3f1d5e72cb2c6d34c2d7788f12ba42e0f592011:/src/kernel/activity/SleepImpl.cpp diff --git a/src/kernel/activity/SleepImpl.cpp b/src/kernel/activity/SleepImpl.cpp index 18bdbef0d7..3072fb9ac3 100644 --- a/src/kernel/activity/SleepImpl.cpp +++ b/src/kernel/activity/SleepImpl.cpp @@ -8,9 +8,6 @@ #include "simgrid/kernel/resource/Action.hpp" #include "simgrid/s4u/Host.hpp" #include "src/kernel/context/Context.hpp" - -#include "simgrid/Exception.hpp" -#include "src/simix/ActorImpl.hpp" #include "src/simix/popping_private.hpp" #include "src/simix/smx_private.hpp" #include "src/surf/cpu_interface.hpp" @@ -21,16 +18,27 @@ namespace simgrid { namespace kernel { namespace activity { -SleepImpl::~SleepImpl() +SleepImpl& SleepImpl::set_name(const std::string& name) { - if (surf_action_) - surf_action_->unref(); - XBT_DEBUG("Destroy activity %p", this); + ActivityImpl::set_name(name); + return *this; } -SleepImpl* SleepImpl::start(double duration) +SleepImpl& SleepImpl::set_host(s4u::Host* host) { - surf_action_ = host_->pimpl_cpu->sleep(duration); + host_ = host; + return *this; +} + +SleepImpl& SleepImpl::set_duration(double duration) +{ + duration_ = duration; + return *this; +} + +SleepImpl* SleepImpl::start() +{ + surf_action_ = host_->pimpl_cpu->sleep(duration_); surf_action_->set_data(this); XBT_DEBUG("Create sleep synchronization %p", this); return this; @@ -62,7 +70,6 @@ void SleepImpl::post() default: THROW_IMPOSSIBLE; - break; } if (not simcall->issuer->get_host()->is_on()) { simcall->issuer->context_->iwannadie = true; @@ -77,10 +84,12 @@ void SleepImpl::post() SIMIX_simcall_answer(simcall); } } - SIMIX_process_sleep_destroy(this); } - +void SleepImpl::finish() +{ + /* FIXME some part of post should move to finish */ +} } // namespace activity } // namespace kernel } // namespace simgrid