Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make field 'mc::ActorState::times_considered' private.
[simgrid.git] / src / mc / api.cpp
index d1628af..cdb3224 100644 (file)
@@ -108,25 +108,23 @@ static inline smx_simcall_t MC_state_choose_request_for_process(const RemoteProc
 
   smx_simcall_t req = nullptr;
   if (actor->simcall_.observer_ != nullptr) {
-    state->transition_.times_considered_ = procstate->times_considered;
-    procstate->times_considered++;
-    if (actor->simcall_.mc_max_consider_ <= procstate->times_considered)
+    state->transition_.times_considered_ = procstate->get_times_considered_and_inc();
+    if (actor->simcall_.mc_max_consider_ <= procstate->get_times_considered())
       procstate->set_done();
     req = &actor->simcall_;
   } else
     switch (actor->simcall_.call_) {
       case Simcall::COMM_WAITANY:
         state->transition_.times_considered_ = -1;
-        while (procstate->times_considered < simcall_comm_waitany__get__count(&actor->simcall_)) {
-          if (simgrid::mc::request_is_enabled_by_idx(process, &actor->simcall_, procstate->times_considered)) {
-            state->transition_.times_considered_ = procstate->times_considered;
-            ++procstate->times_considered;
+        while (procstate->get_times_considered() < simcall_comm_waitany__get__count(&actor->simcall_)) {
+          if (simgrid::mc::request_is_enabled_by_idx(process, &actor->simcall_, procstate->get_times_considered())) {
+            state->transition_.times_considered_ = procstate->get_times_considered_and_inc();
             break;
           }
-          ++procstate->times_considered;
+          procstate->get_times_considered_and_inc();
         }
 
-        if (procstate->times_considered >= simcall_comm_waitany__get__count(&actor->simcall_))
+        if (procstate->get_times_considered() >= simcall_comm_waitany__get__count(&actor->simcall_))
           procstate->set_done();
         if (state->transition_.times_considered_ != -1)
           req = &actor->simcall_;
@@ -134,16 +132,15 @@ static inline smx_simcall_t MC_state_choose_request_for_process(const RemoteProc
 
       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(process, &actor->simcall_, procstate->times_considered)) {
-            state->transition_.times_considered_ = procstate->times_considered;
-            ++procstate->times_considered;
+        while (procstate->get_times_considered() < simcall_comm_testany__get__count(&actor->simcall_)) {
+          if (simgrid::mc::request_is_enabled_by_idx(process, &actor->simcall_, procstate->get_times_considered())) {
+            state->transition_.times_considered_ = procstate->get_times_considered_and_inc();
             break;
           }
-          ++procstate->times_considered;
+          procstate->get_times_considered_and_inc();
         }
 
-        if (procstate->times_considered >= simcall_comm_testany__get__count(&actor->simcall_))
+        if (procstate->get_times_considered() >= simcall_comm_testany__get__count(&actor->simcall_))
           procstate->set_done();
         if (state->transition_.times_considered_ != -1)
           req = &actor->simcall_;