Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
[simgrid.git] / src / mc / api.cpp
index 4bc2330..cee3dcc 100644 (file)
@@ -93,7 +93,7 @@ static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::Sta
           req = &actor->simcall_;
         break;
 
-      case Simcall::COMM_TESTANY: {
+      case Simcall::COMM_TESTANY:
         state->transition_.times_considered_ = -1;
         while (procstate->times_considered < simcall_comm_testany__get__count(&actor->simcall_)) {
           if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall_, procstate->times_considered)) {
@@ -109,7 +109,6 @@ static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::Sta
         if (state->transition_.times_considered_ != -1)
           req = &actor->simcall_;
         break;
-      }
 
       case Simcall::COMM_WAIT: {
         simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
@@ -358,10 +357,13 @@ bool Api::actor_is_enabled(aid_t pid) const
 
 unsigned long Api::get_maxpid() const
 {
+  static const char* name = nullptr;
+  if (not name) {
+    name = "simgrid::kernel::actor::maxpid";
+    if (mc_model_checker->get_remote_simulation().find_variable(name) == nullptr)
+      name = "maxpid"; // We seem to miss the namespaces when compiling with GCC
+  }
   unsigned long maxpid;
-  const char* name = "simgrid::kernel::actor::maxpid";
-  if (mc_model_checker->get_remote_simulation().find_variable(name) == nullptr)
-    name = "maxpid"; // We seem to miss the namespaces when compiling with GCC
   mc_model_checker->get_remote_simulation().read_variable(name, &maxpid, sizeof(maxpid));
   return maxpid;
 }
@@ -799,18 +801,11 @@ std::string Api::request_to_string(smx_simcall_t req, int value) const
       }
       break;
 
-    case Simcall::MUTEX_TRYLOCK:
     case Simcall::MUTEX_LOCK: {
-      if (req->call_ == Simcall::MUTEX_LOCK)
-        type = "Mutex LOCK";
-      else
-        type = "Mutex TRYLOCK";
-
+      type = "Mutex LOCK";
       simgrid::mc::Remote<simgrid::kernel::activity::MutexImpl> mutex;
       mc_model_checker->get_remote_simulation().read_bytes(mutex.get_buffer(), sizeof(mutex),
-                                                           remote(req->call_ == Simcall::MUTEX_LOCK
-                                                                      ? simcall_mutex_lock__get__mutex(req)
-                                                                      : simcall_mutex_trylock__get__mutex(req)));
+                                                           remote(simcall_mutex_lock__get__mutex(req)));
       args = "locked = " + std::to_string(mutex.get_buffer()->is_locked()) + ", owner = ";
       if (mutex.get_buffer()->get_owner() != nullptr)
         args += std::to_string(mc_model_checker->get_remote_simulation()
@@ -898,10 +893,6 @@ std::string Api::request_get_dot_output(smx_simcall_t req, int value) const
         }
         break;
 
-      case Simcall::MUTEX_TRYLOCK:
-        label = "[" + get_actor_dot_label(issuer) + "] Mutex TRYLOCK";
-        break;
-
       case Simcall::MUTEX_LOCK:
         label = "[" + get_actor_dot_label(issuer) + "] Mutex LOCK";
         break;