#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"
namespace kernel {
namespace activity {
-SleepImpl::~SleepImpl()
+SleepImplPtr SleepImpl::set_name(const std::string& name)
+{
+ ActivityImpl::set_name(name);
+ return this;
+}
+
+SleepImplPtr SleepImpl::set_host(s4u::Host* host)
+{
+ host_ = host;
+ return this;
+}
+
+SleepImplPtr SleepImpl::set_duration(double duration)
{
- if (surf_action_)
- surf_action_->unref();
- XBT_DEBUG("Destroy activity %p", this);
+ duration_ = duration;
+ return this;
}
-SleepImpl* SleepImpl::start(double duration)
+SleepImpl* SleepImpl::start()
{
- surf_action_ = host_->pimpl_cpu->sleep(duration);
+ surf_action_ = host_->pimpl_cpu->sleep(duration_);
surf_action_->set_data(this);
XBT_DEBUG("Create sleep synchronization %p", this);
return this;
default:
THROW_IMPOSSIBLE;
- break;
}
if (not simcall->issuer->get_host()->is_on()) {
simcall->issuer->context_->iwannadie = true;
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