identification->notify_all();
checkpoint->unlock();
- // TODO simgrid::s4u::this_actor::suspend(); to replace the sleep below
- simgrid::s4u::this_actor::sleep_for(4);
+ simgrid::s4u::this_actor::suspend();
+
XBT_INFO("I've been moved on this new host: %s", simgrid::s4u::this_actor::host()->cname());
XBT_INFO("Uh, nothing to do here. Stopping now");
}
controlled_process->migrate(simgrid::s4u::Host::by_name("Jacquelin")); /* - Move an emigrant to Jacquelin */
XBT_INFO("I moved the emigrant");
- // TODO simgrid::s4u::this_actor::resume()
+ controlled_process->resume();
checkpoint->unlock();
}
> [ 0.000000] (emigrant@Boivin) Yeah, found something to do
> [ 0.000000] (policeman@Boivin) Wait at the checkpoint.
> [ 3.000000] (emigrant@Boivin) Moving back home after work
+> [ 7.000000] (maestro@) Simulation time 7
+> [ 7.000000] (emigrant@Jacquelin) I've been moved on this new host: Jacquelin
+> [ 7.000000] (emigrant@Jacquelin) Uh, nothing to do here. Stopping now
> [ 7.000000] (policeman@Boivin) I moved the emigrant
-> [ 11.000000] (emigrant@Jacquelin) I've been moved on this new host: Jacquelin
-> [ 11.000000] (emigrant@Jacquelin) Uh, nothing to do here. Stopping now
-> [ 11.000000] (maestro@) Simulation time 11
/** Retrieves the PPID of that actor */
int ppid();
+ /** Suspend an actor by suspending the task on which it was waiting for the completion. */
+ void suspend();
+
+ /** Resume a suspended process by resuming the task on which it was waiting for the completion. */
+ void resume();
+
/** If set to true, the actor will automatically restart when its host reboots */
void setAutoRestart(bool autorestart);
/** Sets the time at which that actor should be killed */
/** @brief Returns the name of the host on which the process is running. */
XBT_PUBLIC(Host*) host();
+ /** @brief Suspend the actor. */
+ XBT_PUBLIC(void) suspend();
+
+ /** @brief Resume the actor. */
+ XBT_PUBLIC(void) resume();
+
+ /** @brief Migrate the actor to a new host. */
XBT_PUBLIC(void) migrate(Host* new_host);
};
return this->pimpl_->ppid;
}
+void Actor::suspend()
+{
+ simcall_process_suspend(pimpl_);
+}
+
+void Actor::resume()
+{
+ simcall_process_resume(pimpl_);
+}
+
void Actor::setKillTime(double time) {
simcall_process_set_kill_time(pimpl_,time);
}
return SIMIX_process_self()->host;
}
+void suspend()
+{
+ simcall_process_suspend(SIMIX_process_self());
+}
+
+void resume()
+{
+ simcall_process_resume(SIMIX_process_self());
+}
+
void migrate(Host* new_host)
{
simcall_process_set_host(SIMIX_process_self(), new_host);