+
+void Global::empty_trash()
+{
+ while (not actors_to_destroy.empty()) {
+ kernel::actor::ActorImpl* actor = &actors_to_destroy.front();
+ actors_to_destroy.pop_front();
+ XBT_DEBUG("Getting rid of %s (refcount: %d)", actor->get_cname(), actor->get_refcount());
+ intrusive_ptr_release(actor);
+ }
+#if SIMGRID_HAVE_MC
+ xbt_dynar_reset(dead_actors_vector);
+#endif
+}
+/**
+ * @brief Executes the actors in actors_to_run.
+ *
+ * The actors in actors_to_run are run (in parallel if possible). On exit, actors_to_run is empty, and actors_that_ran
+ * contains the list of actors that just ran. The two lists are swapped so, be careful when using them before and after
+ * a call to this function.
+ */
+void Global::run_all_actors()
+{
+ simix_global->context_factory->run_all();
+
+ actors_to_run.swap(actors_that_ran);
+ actors_to_run.clear();
+}
+
+/** Wake up all actors waiting for a Surf action to finish */
+void Global::wake_all_waiting_actors()
+{
+ for (auto const& model : all_existing_models) {
+ kernel::resource::Action* action;
+
+ XBT_DEBUG("Handling the failed actions (if any)");
+ while ((action = model->extract_failed_action())) {
+ XBT_DEBUG(" Handling Action %p", action);
+ if (action->get_activity() != nullptr)
+ kernel::activity::ActivityImplPtr(action->get_activity())->post();
+ }
+ XBT_DEBUG("Handling the terminated actions (if any)");
+ while ((action = model->extract_done_action())) {
+ XBT_DEBUG(" Handling Action %p", action);
+ if (action->get_activity() == nullptr)
+ XBT_DEBUG("probably vcpu's action %p, skip", action);
+ else
+ kernel::activity::ActivityImplPtr(action->get_activity())->post();
+ }
+ }