-void ExecImpl::wait_any_for(actor::ActorImpl* issuer, const std::vector<ExecImpl*>& execs, double timeout)
-{
- if (timeout < 0.0) {
- issuer->simcall_.timeout_cb_ = nullptr;
- } else {
- issuer->simcall_.timeout_cb_ = timer::Timer::set(s4u::Engine::get_clock() + timeout, [issuer, &execs]() {
- issuer->simcall_.timeout_cb_ = nullptr;
- for (auto* exec : execs)
- exec->unregister_simcall(&issuer->simcall_);
- // default result (-1) is set in actor::ExecutionWaitanySimcall
- issuer->simcall_answer();
- });
- }
-
- for (auto* exec : execs) {
- /* associate this simcall to the the synchro */
- exec->simcalls_.push_back(&issuer->simcall_);
- /* see if the synchro is already finished */
- if (exec->state_ != State::WAITING && exec->state_ != State::RUNNING) {
- exec->finish();
- break;
- }
- }
-}
-