Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into depencencies
[simgrid.git] / src / kernel / activity / ConditionVariableImpl.hpp
index f165dde..eb6937b 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (c) 2012-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2020. 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. */
 
-#ifndef SIMGRID_KERNEL_ACTIVITY_CONDITIONVARIABLEIMPL_HPP
-#define SIMGRID_KERNEL_ACTIVITY_CONDITIONVARIABLEIMPL_HPP
+#ifndef SIMGRID_KERNEL_ACTIVITY_CONDITIONVARIABLE_HPP
+#define SIMGRID_KERNEL_ACTIVITY_CONDITIONVARIABLE_HPP
 
 #include "simgrid/s4u/ConditionVariable.hpp"
 #include "src/kernel/actor/ActorImpl.hpp"
@@ -15,22 +15,23 @@ namespace kernel {
 namespace activity {
 
 class XBT_PUBLIC ConditionVariableImpl {
-public:
-  ConditionVariableImpl();
-  ~ConditionVariableImpl();
-
-  actor::SynchroList sleeping_; /* list of sleeping processes */
   MutexImpl* mutex_ = nullptr;
-  s4u::ConditionVariable cond_;
-
-  void broadcast();
-  void signal();
-  void wait(MutexImpl* mutex, double timeout, actor::ActorImpl* issuer, smx_simcall_t simcall);
+  s4u::ConditionVariable piface_;
+  actor::SynchroList sleeping_; /* list of sleeping actors*/
 
-private:
   std::atomic_int_fast32_t refcount_{1};
   friend void intrusive_ptr_add_ref(ConditionVariableImpl* cond);
   friend void intrusive_ptr_release(ConditionVariableImpl* cond);
+
+public:
+  ConditionVariableImpl() : piface_(this){};
+  ~ConditionVariableImpl() = default;
+
+  void remove_sleeping_actor(actor::ActorImpl& actor) { xbt::intrusive_erase(sleeping_, actor); }
+  s4u::ConditionVariable* get_iface() { return &piface_; }
+  void broadcast();
+  void signal();
+  void wait(MutexImpl* mutex, double timeout, actor::ActorImpl* issuer);
 };
 } // namespace activity
 } // namespace kernel