X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ddb45d457a6e56461f506cba0add22902ef2c7d7..d800adcfdddbc6283a830288babe78a59a3ae079:/src/mc/api.cpp diff --git a/src/mc/api.cpp b/src/mc/api.cpp index 512c221707..cdb3224e49 100644 --- a/src/mc/api.cpp +++ b/src/mc/api.cpp @@ -1,3 +1,8 @@ +/* Copyright (c) 2020-2021. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + #include "api.hpp" #include "src/kernel/activity/MailboxImpl.hpp" @@ -5,6 +10,7 @@ #include "src/kernel/actor/SimcallObserver.hpp" #include "src/mc/Session.hpp" #include "src/mc/checker/Checker.hpp" +#include "src/mc/mc_base.hpp" #include "src/mc/mc_comm_pattern.hpp" #include "src/mc/mc_exit.hpp" #include "src/mc/mc_pattern.hpp" @@ -102,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_; @@ -128,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_;