#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/modelchecker.h"
#include "simgrid/s4u/Exec.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/surf/HostImpl.hpp"
#include "src/surf/cpu_interface.hpp"
#include "simgrid/s4u/Host.hpp"
-#include <boost/range/algorithm.hpp>
-
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
-void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall,
- const std::vector<simgrid::kernel::activity::ExecImpl*>* execs,
- double timeout)
-{
- simgrid::kernel::activity::ExecImpl::wait_any_for(simcall->issuer_, execs, timeout);
-}
-
namespace simgrid {
namespace kernel {
namespace activity {
if (simcall->call_ == simix::Simcall::NONE) // FIXME: maybe a better way to handle this case
continue; // if process handling comm is killed
- if (simcall->call_ == simix::Simcall::EXECUTION_WAITANY_FOR) {
- const std::vector<simgrid::kernel::activity::ExecImpl*>* execs =
- simcall_execution_waitany_for__get__execs(simcall);
+ if (auto* observer = dynamic_cast<mc::ExecutionWaitanySimcall*>(simcall->observer_)) { // simcall is a wait_any?
+ const auto* execs = observer->get_execs();
for (auto* exec : *execs) {
- // Remove the first occurrence of simcall:
- auto j = boost::range::find(exec->simcalls_, simcall);
- if (j != exec->simcalls_.end())
- exec->simcalls_.erase(j);
+ exec->unregister_simcall(simcall);
if (simcall->timeout_cb_) {
simcall->timeout_cb_->remove();
if (not MC_is_active() && not MC_record_replay_is_active()) {
auto element = std::find(execs->begin(), execs->end(), this);
- int rank = (element != execs->end()) ? std::distance(execs->begin(), element) : -1;
- simcall_execution_waitany_for__set__result(simcall, rank);
+ int rank = element != execs->end() ? static_cast<int>(std::distance(execs->begin(), element)) : -1;
+ observer->set_result(rank);
}
}
switch (state_) {
} else {
issuer->simcall_.timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, execs]() {
issuer->simcall_.timeout_cb_ = nullptr;
- for (auto* exec : *execs) {
- // Remove the first occurrence of simcall:
- auto j = boost::range::find(exec->simcalls_, &issuer->simcall_);
- if (j != exec->simcalls_.end())
- exec->simcalls_.erase(j);
- }
- simcall_execution_waitany_for__set__result(&issuer->simcall_, -1);
+ for (auto* exec : *execs)
+ exec->unregister_simcall(&issuer->simcall_);
+ // default result (-1) is set in mc::ExecutionWaitanySimcall
issuer->simcall_answer();
});
}