"When non-negative, raise a SIGTRAP after given (simulated) time", -1.0};
config::Flag<bool> cfg_verbose_exit{"debug/verbose-exit", "Display the actor status at exit", true};
-xbt_dynar_t get_actors_addr()
-{
-#if SIMGRID_HAVE_MC
- return EngineImpl::get_instance()->get_actors_vector();
-#else
- xbt_die("This function is intended to be used when compiling with MC");
-#endif
-}
-
constexpr std::initializer_list<std::pair<const char*, context::ContextFactoryInitializer>> context_factories = {
#if HAVE_RAW_CONTEXTS
{"raw", &context::raw_factory},
// The communication initialization is done ASAP, as we need to get some init parameters from the MC for different
// layers. But instance_ needs to be created, as we send the address of some of its fields to the MC that wants to
// read them directly.
- simgrid::mc::AppSide::initialize();
+ simgrid::mc::AppSide::initialize(actors_vector_);
#endif
if (xbt_initialized == 0) {
namespace simgrid {
namespace kernel {
-// In MC mode, the application sends these pointers to the MC
-xbt_dynar_t get_actors_addr();
class EngineImpl {
std::map<std::string, s4u::Host*, std::less<>> hosts_;
void add_split_duplex_link(const std::string& name, std::unique_ptr<resource::SplitDuplexLinkImpl> link);
#if SIMGRID_HAVE_MC
- xbt_dynar_t get_actors_vector() const { return actors_vector_; }
void reset_actor_dynar() { xbt_dynar_reset(actors_vector_); }
void add_actor_to_dynar(actor::ActorImpl* actor) { xbt_dynar_push_as(actors_vector_, actor::ActorImpl*, actor); }
#endif
std::unique_ptr<AppSide> AppSide::instance_;
-AppSide* AppSide::initialize()
+AppSide* AppSide::initialize(xbt_dynar_t actors_addr)
{
if (not std::getenv(MC_ENV_SOCKET_FD)) // We are not in MC mode: don't initialize the MC world
return nullptr;
strerror(errno));
s_mc_message_initial_addresses_t message{MessageType::INITIAL_ADDRESSES, mmalloc_preinit(),
- kernel::actor::get_maxpid_addr(), kernel::get_actors_addr()};
+ kernel::actor::get_maxpid_addr(), actors_addr};
xbt_assert(instance_->channel_.send(message) == 0, "Could not send the initial message with addresses.");
instance_->handle_messages();
// Singleton :/
// TODO, remove the singleton antipattern.
- static AppSide* initialize();
+ static AppSide* initialize(xbt_dynar_t actors_addr);
static AppSide* get() { return instance_.get(); }
};
} // namespace mc