Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / include / simgrid / s4u / ConditionVariable.hpp
index 934780b..82d16d8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2022. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -9,6 +9,7 @@
 #include <simgrid/forward.h>
 
 #include <simgrid/chrono.hpp>
+#include <simgrid/s4u/Engine.hpp>
 #include <simgrid/s4u/Mutex.hpp>
 
 #include <future>
@@ -25,13 +26,16 @@ namespace s4u {
  */
 class XBT_PUBLIC ConditionVariable {
 private:
+#ifndef DOXYGEN
   friend kernel::activity::ConditionVariableImpl;
+  friend void kernel::activity::intrusive_ptr_release(kernel::activity::ConditionVariableImpl* cond);
+#endif
+
   kernel::activity::ConditionVariableImpl* const pimpl_;
 
-public:
-#ifndef DOXYGEN
   explicit ConditionVariable(kernel::activity::ConditionVariableImpl* cond) : pimpl_(cond) {}
-
+  ~ConditionVariable() = default;
+#ifndef DOXYGEN
   ConditionVariable(ConditionVariable const&) = delete;
   ConditionVariable& operator=(ConditionVariable const&) = delete;
 
@@ -39,6 +43,7 @@ public:
   friend XBT_PUBLIC void intrusive_ptr_release(const ConditionVariable* cond);
 #endif
 
+public:
   /** Create a new condition variable and return a smart pointer
    *
    * @beginrst
@@ -72,7 +77,7 @@ public:
   /// 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));
+    return this->wait_until(lock, Engine::get_clock() + duration, std::move(pred));
   }
 
   // Wait function taking a C++ style time: