Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 21 Jun 2016 08:36:48 +0000 (10:36 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 21 Jun 2016 08:36:48 +0000 (10:36 +0200)
include/simgrid/s4u/conditionVariable.hpp

index 9c9c58a..d5b9244 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(lock, duration);
+  }
+  // TODO,wait_until
 
   /**
   * Notify functions