+smx_activity_t ActorImpl::suspend(ActorImpl* issuer)
+{
+ if (suspended_) {
+ XBT_DEBUG("Actor '%s' is already suspended", get_cname());
+ return nullptr;
+ }
+
+ suspended_ = true;
+
+ /* If we are suspending another actor that is waiting on a sync, suspend its synchronization. */
+ if (this != issuer) {
+ if (waiting_synchro)
+ waiting_synchro->suspend();
+ /* If the other actor is not waiting, its suspension is delayed to when the actor is rescheduled. */
+
+ return nullptr;
+ } else {
+ return SIMIX_execution_start("suspend", "", 0.0, 1.0, 0.0, this->host_);
+ }
+}
+
+void ActorImpl::resume()
+{
+ XBT_IN("process = %p", this);
+
+ if (context_->iwannadie) {
+ XBT_VERB("Ignoring request to suspend an actor that is currently dying.");
+ return;
+ }
+
+ if (not suspended_)
+ return;
+ suspended_ = false;
+
+ /* resume the synchronization that was blocking the resumed actor. */
+ if (waiting_synchro)
+ waiting_synchro->resume();
+
+ XBT_OUT();
+}
+
+smx_activity_t ActorImpl::sleep(double duration)
+{
+ if (host_->is_off())
+ THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host_->get_cname());
+
+ simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
+ synchro->host = host_;
+ synchro->surf_sleep = host_->pimpl_cpu->sleep(duration);
+ synchro->surf_sleep->set_data(synchro);
+ XBT_DEBUG("Create sleep synchronization %p", synchro);
+
+ return synchro;
+}
+
+void create_maestro(simgrid::simix::ActorCode code)