-/**
- * @brief Executes the processes from simix_global->process_to_run.
- *
- * The processes of simix_global->process_to_run are run (in parallel if
- * possible). On exit, simix_global->process_to_run is empty, and
- * simix_global->process_that_ran contains the list of processes that just ran.
- * The two lists are swapped so, be careful when using them before and after a
- * call to this function.
- */
-void SIMIX_process_runall()
-{
- SIMIX_context_runall();
-
- simix_global->process_to_run.swap(simix_global->process_that_ran);
- simix_global->process_to_run.clear();
-}
-
-/**
- * @brief Internal function to kill a SIMIX process.
- *
- * This function may be called when a SIMCALL_PROCESS_KILL simcall occurs,
- * or directly for SIMIX internal purposes.
- *
- * @param process poor victim
- * @param issuer the process which has sent the PROCESS_KILL. Important to not schedule twice the same process.
- */
-void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
-
- if (process->finished_) {
- XBT_DEBUG("Ignoring request to kill process %s@%s that is already dead", process->get_cname(),
- process->host_->get_cname());
- return;
- }
-
- XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->get_cname(),
- (issuer->host_ == nullptr ? "(null)" : issuer->host_->get_cname()), process->get_cname(),
- process->host_->get_cname());
-
- process->context_->iwannadie = true;
- process->blocked_ = false;
- process->suspended_ = false;
- process->exception = nullptr;
-
- /* destroy the blocking synchro if any */
- if (process->waiting_synchro != nullptr) {
- if (process->host_->is_off())
- process->exception = std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
- simgrid::kernel::activity::ExecImplPtr exec =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(process->waiting_synchro);
- simgrid::kernel::activity::CommImplPtr comm =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(process->waiting_synchro);
- simgrid::kernel::activity::SleepImplPtr sleep =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::SleepImpl>(process->waiting_synchro);
- simgrid::kernel::activity::RawImplPtr raw =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::RawImpl>(process->waiting_synchro);
- simgrid::kernel::activity::IoImplPtr io =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(process->waiting_synchro);
-
- if (exec != nullptr) {
- if (exec->surf_action_) {
- exec->surf_action_->cancel();
- exec->surf_action_->unref();
- exec->surf_action_ = nullptr;
- }
- } else if (comm != nullptr) {
- process->comms.remove(process->waiting_synchro);
- comm->cancel();
- // Remove first occurrence of &process->simcall:
- auto i = boost::range::find(process->waiting_synchro->simcalls_, &process->simcall);
- if (i != process->waiting_synchro->simcalls_.end())
- process->waiting_synchro->simcalls_.remove(&process->simcall);
- } else if (sleep != nullptr) {
- if (sleep->surf_sleep)
- sleep->surf_sleep->cancel();
- sleep->post();
- } else if (raw != nullptr) {
- SIMIX_synchro_stop_waiting(process, &process->simcall);
-
- } else if (io != nullptr) {
- delete io.get();
- } else {
- xbt_die("Unknown type of activity");
- }
-
- process->waiting_synchro = nullptr;
- }
- if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), process) ==
- end(simix_global->process_to_run) &&
- process != issuer) {
- XBT_DEBUG("Inserting %s in the to_run list", process->get_cname());
- simix_global->process_to_run.push_back(process);
- }
-}