Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Modernize simcall mutex_lock.
[simgrid.git] / src / mc / checker / SimcallObserver.cpp
index 9c601be..5a384fd 100644 (file)
@@ -71,5 +71,23 @@ std::string MutexTrylockSimcall::dot_label() const
   return SimcallObserver::dot_label() + "Mutex TRYLOCK";
 }
 
+std::string MutexLockSimcall::to_string(int time_considered) const
+{
+  std::string res = SimcallObserver::to_string(time_considered) + "Mutex LOCK";
+  res += "(locked = " + std::to_string(mutex_->is_locked());
+  res += ", owner = " + std::to_string(mutex_->get_owner() ? mutex_->get_owner()->get_pid() : -1);
+  res += ", sleeping = n/a)";
+  return res;
+}
+
+std::string MutexLockSimcall::dot_label() const
+{
+  return SimcallObserver::dot_label() + "Mutex LOCK";
+}
+
+bool MutexLockSimcall::is_enabled() const
+{
+  return mutex_->get_owner() == nullptr || mutex_->get_owner() == get_issuer();
+}
 } // namespace mc
 } // namespace simgrid