+
+ /* If a waitany simcall is waiting for this synchro to finish, then remove it from the other synchros in the waitany
+ * list. Afterwards, get the position of the actual synchro in the waitany list and return it as the result of the
+ * simcall */
+
+ if (simcall->call == SIMCALL_NONE) // FIXME: maybe a better way to handle this case
+ continue; // if process handling comm is killed
+ if (simcall->call == SIMCALL_EXECUTION_WAITANY_FOR) {
+ simgrid::kernel::activity::ExecImpl** execs = simcall_execution_waitany_for__get__execs(simcall);
+ size_t count = simcall_execution_waitany_for__get__count(simcall);
+
+ for (size_t i = 0; i < count; i++) {
+ // Remove the first occurence of simcall:
+ auto* exec = execs[i];
+ auto j = boost::range::find(exec->simcalls_, simcall);
+ if (j != exec->simcalls_.end())
+ exec->simcalls_.erase(j);
+
+ if (simcall->timer) {
+ simcall->timer->remove();
+ simcall->timer = nullptr;
+ }
+ }
+
+ if (not MC_is_active() && not MC_record_replay_is_active()) {
+ ExecImpl** element = std::find(execs, execs + count, this);
+ int rank = (element != execs + count) ? element - execs : -1;
+ simcall_execution_waitany_for__set__result(simcall, rank);
+ }
+ }
+