Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge oberver classes MutexTrylockSimcall and MutexLockSimcall.
[simgrid.git] / src / mc / checker / SimcallObserver.cpp
index 5a384fd..3b7854c 100644 (file)
@@ -57,23 +57,9 @@ std::string MutexUnlockSimcall::dot_label() const
   return SimcallObserver::dot_label() + "Mutex UNLOCK";
 }
 
-std::string MutexTrylockSimcall::to_string(int time_considered) const
-{
-  std::string res = SimcallObserver::to_string(time_considered) + "Mutex TRYLOCK";
-  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 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";
+  std::string res = SimcallObserver::to_string(time_considered) + (blocking_ ? "Mutex LOCK" : "Mutex TRYLOCK");
   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)";
@@ -82,12 +68,12 @@ std::string MutexLockSimcall::to_string(int time_considered) const
 
 std::string MutexLockSimcall::dot_label() const
 {
-  return SimcallObserver::dot_label() + "Mutex LOCK";
+  return SimcallObserver::dot_label() + (blocking_ ? "Mutex LOCK" : "Mutex TRYLOCK");
 }
 
 bool MutexLockSimcall::is_enabled() const
 {
-  return mutex_->get_owner() == nullptr || mutex_->get_owner() == get_issuer();
+  return not blocking_ || mutex_->get_owner() == nullptr || mutex_->get_owner() == get_issuer();
 }
 } // namespace mc
 } // namespace simgrid