-void SIMIX_process_yield(smx_actor_t self)
-{
- XBT_DEBUG("Yield actor '%s'", self->get_cname());
-
- /* Go into sleep and return control to maestro */
- self->context_->suspend();
-
- /* Ok, maestro returned control to us */
- XBT_DEBUG("Control returned to me: '%s'", self->get_cname());
-
- if (self->context_->iwannadie) {
-
- XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host_->get_cname());
- // throw simgrid::kernel::context::StopRequest(); Does not seem to properly kill the actor
- self->context_->stop();
- THROW_IMPOSSIBLE;
- }
-
- if (self->suspended_) {
- XBT_DEBUG("Hey! I'm suspended.");
- xbt_assert(self->exception != nullptr, "Gasp! This exception may be lost by subsequent calls.");
- self->suspended_ = false;
- self->suspend(self);
- }
-
- if (self->exception != nullptr) {
- XBT_DEBUG("Wait, maestro left me an exception");
- std::exception_ptr exception = std::move(self->exception);
- self->exception = nullptr;
- std::rethrow_exception(std::move(exception));
- }
-
- if (SMPI_switch_data_segment && not self->finished_) {
- SMPI_switch_data_segment(self->iface());
- }
-}