- switch ((*(smx_process_t *)p)->simcall.call) {
- case SIMCALL_NONE:
- case SIMCALL_PROCESS_KILL:
- return 2;
- case SIMCALL_PROCESS_RESUME:
- return 1;
- default:
- return 0;
+ for (auto const& model : *all_existing_models) {
+ simgrid::kernel::resource::Action* action;
+
+ XBT_DEBUG("Handling the processes whose action failed (if any)");
+ while ((action = surf_model_extract_failed_action_set(model))) {
+ XBT_DEBUG(" Handling Action %p",action);
+ SIMIX_simcall_exit(static_cast<simgrid::kernel::activity::ActivityImpl*>(action->getData()));
+ }
+ XBT_DEBUG("Handling the processes whose action terminated normally (if any)");
+ while ((action = surf_model_extract_done_action_set(model))) {
+ XBT_DEBUG(" Handling Action %p",action);
+ if (action->getData() == nullptr)
+ XBT_DEBUG("probably vcpu's action %p, skip", action);
+ else
+ SIMIX_simcall_exit(static_cast<simgrid::kernel::activity::ActivityImpl*>(action->getData()));
+ }
+ }
+}
+
+/** Handle any pending timer */
+static bool SIMIX_execute_timers()
+{
+ bool result = false;
+ while (not simix_timers.empty() && SIMIX_get_clock() >= simix_timers.top().first) {
+ result = true;
+ // FIXME: make the timers being real callbacks
+ // (i.e. provide dispatchers that read and expand the args)
+ smx_timer_t timer = simix_timers.top().second;
+ simix_timers.pop();
+ try {
+ timer->callback();
+ } catch (...) {
+ xbt_die("Exception thrown ouf of timer callback");
+ }
+ delete timer;