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

Public GIT Repository
Add a section presenting an overview of SimGrid design goals
[simgrid.git] / src / s4u / s4u_Mutex.cpp
index 2bec1c841d35a2d3433ae94e792957a304372c6e..d6a65f6d483450bfc6e28a26efdefc93008d039a 100644 (file)
@@ -7,6 +7,7 @@
 #include "simgrid/mutex.h"
 #include "simgrid/s4u/Mutex.hpp"
 #include "src/kernel/activity/MutexImpl.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
 
 namespace simgrid {
 namespace s4u {
@@ -29,7 +30,9 @@ void Mutex::lock()
  */
 void Mutex::unlock()
 {
-  simcall_mutex_unlock(pimpl_);
+  kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+  mc::MutexUnlockSimcall observer{issuer};
+  kernel::actor::simcall([this, issuer] { this->pimpl_->unlock(issuer); }, &observer);
 }
 
 /** @brief Acquire the mutex if it's free, and return false (without blocking) if not */
@@ -44,7 +47,7 @@ bool Mutex::try_lock()
  */
 MutexPtr Mutex::create()
 {
-  kernel::activity::MutexImpl* mutex = kernel::actor::simcall([] { return new kernel::activity::MutexImpl(); });
+  auto* mutex = new kernel::activity::MutexImpl();
   return MutexPtr(&mutex->mutex(), false);
 }