Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add detached isend to maestro to allow tracking in case of fault
[simgrid.git] / src / kernel / activity / SemaphoreImpl.cpp
index 03998f2..c53825f 100644 (file)
@@ -8,16 +8,16 @@
 
 #include "src/kernel/activity/SemaphoreImpl.hpp"
 #include "src/kernel/activity/Synchro.hpp"
-#include "src/kernel/actor/SimcallObserver.hpp"
+#include "src/kernel/actor/SynchroObserver.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
 
 #include <cmath> // std::isfinite
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_semaphore, ker_synchro, "Semaphore kernel-space implementation");
 
-namespace simgrid {
-namespace kernel {
-namespace activity {
+namespace simgrid::kernel::activity {
+
+/* -------- Acquisition -------- */
 
 void SemAcquisitionImpl::wait_for(actor::ActorImpl* issuer, double timeout)
 {
@@ -45,7 +45,7 @@ void SemAcquisitionImpl::post()
 void SemAcquisitionImpl::finish()
 {
   xbt_assert(simcalls_.size() == 1, "Unexpected number of simcalls waiting: %zu", simcalls_.size());
-  smx_simcall_t simcall = simcalls_.front();
+  actor::Simcall* simcall = simcalls_.front();
   simcalls_.pop_front();
 
   if (surf_action_ != nullptr) { // A timeout was declared
@@ -57,7 +57,7 @@ void SemAcquisitionImpl::finish()
         cancel(); // Unregister the acquisition from the semaphore
 
         /* Return to the englobing simcall that the wait_for timeouted */
-        auto* observer = dynamic_cast<kernel::actor::SemAcquireSimcall*>(get_issuer()->simcall_.observer_);
+        auto* observer = dynamic_cast<kernel::actor::SemaphoreAcquisitionObserver*>(get_issuer()->simcall_.observer_);
         xbt_assert(observer != nullptr);
         observer->set_result(true);
       }
@@ -79,6 +79,10 @@ void SemAcquisitionImpl::cancel()
              "Cannot find myself in the waiting queue that I have to leave");
   semaphore_->ongoing_acquisitions_.erase(it);
 }
+
+/* -------- Semaphore -------- */
+unsigned SemaphoreImpl::next_id_ = 0;
+
 SemAcquisitionImplPtr SemaphoreImpl::acquire_async(actor::ActorImpl* issuer)
 {
   auto res = SemAcquisitionImplPtr(new kernel::activity::SemAcquisitionImpl(issuer, this), true);
@@ -113,6 +117,4 @@ void SemaphoreImpl::release()
   }
 }
 
-} // namespace activity
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::activity