]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/activity/ConditionVariableImpl.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid into no_simix_global
[simgrid.git] / src / kernel / activity / ConditionVariableImpl.cpp
index 8b5d7846dfa34a94e5c4c8ad2615d0ecaa58fa0c..b45038143edc40a89aa2825754fb1e328b659902 100644 (file)
@@ -7,7 +7,7 @@
 #include "simgrid/Exception.hpp"
 #include "src/kernel/activity/MutexImpl.hpp"
 #include "src/kernel/activity/SynchroRaw.hpp"
-#include "src/mc/checker/SimcallObserver.hpp"
+#include "src/kernel/actor/SimcallObserver.hpp"
 #include <cmath> // std::isfinite
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_condition, simix_synchro, "Condition variables");
@@ -21,15 +21,14 @@ namespace activity {
 /**
  * @brief Signalizes a condition.
  *
- * Signalizes a condition and wakes up a sleeping process.
- * If there are no process sleeping, no action is done.
+ * Signalizes a condition and wakes up a sleeping actor.
+ * If there are no actor sleeping, no action is done.
  */
 void ConditionVariableImpl::signal()
 {
   XBT_DEBUG("Signal condition %p", this);
 
-  /* If there are processes waiting for the condition choose one and try
-     to make it acquire the mutex */
+  /* If there are actors waiting for the condition choose one and try to make it acquire the mutex */
   if (not sleeping_.empty()) {
     auto& proc = sleeping_.front();
     sleeping_.pop_front();
@@ -39,8 +38,7 @@ void ConditionVariableImpl::signal()
 
     /* Now transform the cond wait simcall into a mutex lock one */
     smx_simcall_t simcall = &proc.simcall_;
-    // FIXME? using here the MC observer to solve a problem not related to MC
-    const auto* observer = dynamic_cast<mc::ConditionWaitSimcall*>(simcall->observer_);
+    const auto* observer  = dynamic_cast<kernel::actor::ConditionWaitSimcall*>(simcall->observer_);
     xbt_assert(observer != nullptr);
     observer->get_mutex()->lock(simcall->issuer_);
   }
@@ -50,8 +48,8 @@ void ConditionVariableImpl::signal()
 /**
  * @brief Broadcasts a condition.
  *
- * Signal ALL processes waiting on a condition.
- * If there are no process waiting, no action is done.
+ * Signal ALL actors waiting on a condition.
+ * If there are no actor waiting, no action is done.
  */
 void ConditionVariableImpl::broadcast()
 {
@@ -78,7 +76,7 @@ void ConditionVariableImpl::wait(smx_mutex_t mutex, double timeout, actor::Actor
 
   RawImplPtr synchro(new RawImpl([this, issuer]() {
     this->remove_sleeping_actor(*issuer);
-    auto* observer = dynamic_cast<mc::ConditionWaitSimcall*>(issuer->simcall_.observer_);
+    auto* observer = dynamic_cast<kernel::actor::ConditionWaitSimcall*>(issuer->simcall_.observer_);
     xbt_assert(observer != nullptr);
     observer->set_result(true);
   }));
@@ -88,12 +86,12 @@ void ConditionVariableImpl::wait(smx_mutex_t mutex, double timeout, actor::Actor
 }
 
 // boost::intrusive_ptr<ConditionVariableImpl> support:
-void intrusive_ptr_add_ref(simgrid::kernel::activity::ConditionVariableImpl* cond)
+void intrusive_ptr_add_ref(ConditionVariableImpl* cond)
 {
   cond->refcount_.fetch_add(1, std::memory_order_relaxed);
 }
 
-void intrusive_ptr_release(simgrid::kernel::activity::ConditionVariableImpl* cond)
+void intrusive_ptr_release(ConditionVariableImpl* cond)
 {
   if (cond->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
     std::atomic_thread_fence(std::memory_order_acquire);