- /// Wait until predicate is true, or the given instant (specified as a plain double)
- template <class P> bool wait_until(const std::unique_lock<s4u::Mutex>& lock, double timeout_time, P pred)
- {
- while (not pred())
- if (this->wait_until(lock, timeout_time) == std::cv_status::timeout)
- return pred();
- return true;
- }
- /// As long as the predicate is false, wait for the given amount of seconds (specified as a plain double)
- template <class P> bool wait_for(const std::unique_lock<s4u::Mutex>& lock, double duration, P pred)
- {
- return this->wait_until(lock, SIMIX_get_clock() + duration, std::move(pred));
- }