#include "mc/mc.h"
#include "simgrid/Exception.hpp"
+#include "simgrid/s4u/Actor.hpp"
+#include "simgrid/s4u/Exec.hpp"
#include "smx_private.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
return nullptr;
} else {
- return SIMIX_execution_start("suspend", "", 0.0, 1.0, 0.0, this->host_);
+ return activity::ExecImplPtr(new activity::ExecImpl("suspend", "", nullptr, this->host_))->start(0.0, 1.0, 0.0);
}
}
throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
XBT_THROW_POINT, std::string("Host ") + std::string(host_->get_cname()) + " failed, you cannot sleep there.")));
- simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
- synchro->host = host_;
- synchro->surf_action_ = host_->pimpl_cpu->sleep(duration);
- synchro->surf_action_->set_data(synchro);
- XBT_DEBUG("Create sleep synchronization %p", synchro);
-
- return synchro;
+ return simgrid::kernel::activity::SleepImplPtr(new simgrid::kernel::activity::SleepImpl("sleep", host_))
+ ->start(duration);
}
void ActorImpl::throw_exception(std::exception_ptr e)
waiting_synchro = nullptr;
}
+void ActorImpl::set_host(sg_host_t dest)
+{
+ simgrid::xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
+ host_ = dest;
+ dest->pimpl_->process_list_.push_back(*this);
+}
+
ActorImplPtr ActorImpl::create(std::string name, simgrid::simix::ActorCode code, void* data, simgrid::s4u::Host* host,
std::unordered_map<std::string, std::string>* properties, smx_actor_t parent_actor)
{
SIMIX_process_kill(kv.second, issuer);
}
-void SIMIX_process_change_host(smx_actor_t actor, sg_host_t dest)
-{
- xbt_assert((actor != nullptr), "Invalid parameters");
- simgrid::xbt::intrusive_erase(actor->host_->pimpl_->process_list_, *actor);
- actor->host_ = dest;
- dest->pimpl_->process_list_.push_back(*actor);
-}
void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t actor)
{