From ec02e7dbba648af74ef31ac28929d153db6d53f5 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 18 Nov 2023 16:01:38 +0100 Subject: [PATCH] Kill unstandard, untested and dubious ways to use ConditionVariables --- include/simgrid/s4u/ConditionVariable.hpp | 27 ----------------------- 1 file changed, 27 deletions(-) diff --git a/include/simgrid/s4u/ConditionVariable.hpp b/include/simgrid/s4u/ConditionVariable.hpp index f2f0744c29..448b4a8391 100644 --- a/include/simgrid/s4u/ConditionVariable.hpp +++ b/include/simgrid/s4u/ConditionVariable.hpp @@ -65,29 +65,9 @@ public: std::cv_status wait_until(const std::unique_lock& lock, double timeout_time); /// Wait for the given amount of seconds (specified as a plain double) std::cv_status wait_for(const std::unique_lock& lock, double duration); - /// Wait until predicate is true, or the given instant (specified as a plain double) - template bool wait_until(const std::unique_lock& 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 bool wait_for(const std::unique_lock& lock, double duration, P pred) - { - return this->wait_until(lock, Engine::get_clock() + duration, std::move(pred)); - } // Wait function taking a C++ style time: - /// As long as the predicate is false, wait for the given amount of seconds (specified in C++ style) - template - bool wait_for(const std::unique_lock& lock, std::chrono::duration duration, P pred) - { - auto seconds = std::chrono::duration_cast(duration); - return this->wait_for(lock, seconds.count(), pred); - } /// Wait for the given amount of seconds (specified in C++ style) template std::cv_status wait_for(const std::unique_lock& lock, std::chrono::duration duration) @@ -102,13 +82,6 @@ public: auto timeout_native = std::chrono::time_point_cast(timeout_time); return this->wait_until(lock, timeout_native.time_since_epoch().count()); } - /** Wait until predicate is true, or the given instant (specified in C++ style) */ - template - bool wait_until(const std::unique_lock& lock, const SimulationTimePoint& timeout_time, P pred) - { - auto timeout_native = std::chrono::time_point_cast(timeout_time); - return this->wait_until(lock, timeout_native.time_since_epoch().count(), std::move(pred)); - } /** Unblock one actor blocked on that condition variable. If none was blocked, nothing happens. */ void notify_one(); -- 2.20.1