Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[s4u] Fix compilation of ConditionVariable::wait_for(lock, duration, pred)
[simgrid.git] / include / simgrid / s4u / conditionVariable.hpp
index 9c9c58a..ce06ef0 100644 (file)
@@ -51,7 +51,25 @@ public:
   * Wait functions
   */
   void wait(std::unique_lock<Mutex>& lock);
-  void wait_for(std::unique_lock<Mutex>& lock, double time);
+  // TODO, return std::cv_status
+  void wait_for(std::unique_lock<Mutex>& lock, double duration);
+  // TODO, wait_until
+
+  /** Variant which takes a predice */
+  template<class P>
+  void wait(std::unique_lock<Mutex>& lock, P pred)
+  {
+    while (!pred())
+      wait(lock);
+  }
+  // TODO, return std::cv_status
+  template<class P>
+  void wait_for(std::unique_lock<Mutex>& lock, double duration, P pred)
+  {
+    while (!pred())
+      wait_for(lock, duration);
+  }
+  // TODO,wait_until
 
   /**
   * Notify functions