#include "simgrid/modelchecker.h"
#include "src/mc/mc_replay.hpp"
#include "src/simix/smx_private.hpp"
+#include <boost/range/algorithm.hpp>
#include <cmath> // isfinite()
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
simcall->issuer_->waiting_synchro_ = this;
}
+void ActivityImpl::unregister_simcall(smx_simcall_t simcall)
+{
+ // Remove the first occurrence of simcall:
+ auto j = boost::range::find(simcalls_, simcall);
+ if (j != simcalls_.end())
+ simcalls_.erase(j);
+}
+
void ActivityImpl::clean_action()
{
if (surf_action_) {
// the model or because it terminated without waiting for the model
virtual void register_simcall(smx_simcall_t simcall);
+ void unregister_simcall(smx_simcall_t simcall);
void clean_action();
virtual double get_remaining() const;
const char* get_state_str() const;
#include "src/surf/network_interface.hpp"
#include "src/surf/surf_interface.hpp"
-#include <boost/range/algorithm.hpp>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "SIMIX network-related synchronization");
XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t src, smx_mailbox_t mbox, double task_size,
simgrid::kernel::activity::CommImpl** comms = simcall_comm_waitany__get__comms(simcall);
size_t count = simcall_comm_waitany__get__count(simcall);
- for (size_t i = 0; i < count; i++) {
- // Remove the first occurrence of simcall:
- auto* comm = comms[i];
- auto j = boost::range::find(comm->simcalls_, simcall);
- if (j != comm->simcalls_.end())
- comm->simcalls_.erase(j);
- }
+ for (size_t i = 0; i < count; i++)
+ comms[i]->unregister_simcall(simcall);
}
void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comms[], size_t count,
double timeout)
#include "simgrid/s4u/Host.hpp"
-#include <boost/range/algorithm.hpp>
-
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
namespace simgrid {
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();
} 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);
- }
+ for (auto* exec : *execs)
+ exec->unregister_simcall(&issuer->simcall_);
simix::marshal<int>(issuer->simcall_.result_, -1);
issuer->simcall_answer();
});
#include "src/surf/cpu_interface.hpp"
#include <boost/core/demangle.hpp>
-#include <boost/range/algorithm.hpp>
#include <utility>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, "Logging specific to SIMIX (process)");
if (exec != nullptr) {
exec->clean_action();
} else if (comm != nullptr) {
- // Remove first occurrence of &actor->simcall:
- auto i = boost::range::find(waiting_synchro_->simcalls_, &simcall_);
- if (i != waiting_synchro_->simcalls_.end())
- waiting_synchro_->simcalls_.remove(&simcall_);
+ comm->unregister_simcall(&simcall_);
} else {
activity::ActivityImplPtr(waiting_synchro_)->finish();
}