X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/874aec87c7ce1894a9f017d2adf07ce7b8abe71d..ebec9c6104a6bbe60b7bf4586baeaf0b88f53505:/src/s4u/s4u_Engine.cpp diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index 11b8b48e6f..094e8311d1 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -22,7 +22,7 @@ #include #include -XBT_LOG_NEW_CATEGORY(s4u, "Log channels of the S4U (Simgrid for you) interface"); +XBT_LOG_NEW_CATEGORY(s4u, "Log channels of the S4U (SimGrid for you) interface"); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_engine, s4u, "Logging specific to S4U (engine)"); static simgrid::kernel::actor::ActorCode maestro_code; @@ -86,11 +86,6 @@ const std::vector& Engine::get_cmdline() const return pimpl_->get_cmdline(); } -void Engine::shutdown() // XBT_ATTRIB_DEPRECATED_v335 -{ - delete Engine::instance_; -} - double Engine::get_clock() { if (MC_is_active() || MC_record_replay_is_active()) { @@ -248,13 +243,13 @@ std::string Engine::flatify_platform() const ss << "\n"; ss << "\n"; ss << "\n"; - ss << "get_name() << "\" routing=\"Full\">\n"; + ss << "get_name() << "\" routing=\"Full\">\n"; flatify_hosts(*this, ss); flatify_links(*this, ss); flatify_routes(*this, ss); - ss << "\n"; + ss << "\n"; ss << "\n"; return ss.str(); } @@ -405,6 +400,20 @@ Mailbox* Engine::mailbox_by_name_or_create(const std::string& name) const return mbox->get_iface(); } +MessageQueue* Engine::message_queue_by_name_or_create(const std::string& name) const +{ + /* two actors may have pushed the same mbox_create simcall at the same time */ + kernel::activity::MessageQueueImpl* queue = kernel::actor::simcall_answered([&name, this] { + auto [m, inserted] = pimpl_->mqueues_.try_emplace(name, nullptr); + if (inserted) { + m->second = new kernel::activity::MessageQueueImpl(name); + XBT_DEBUG("Creating a message queue at %p with name %s", m->second, name.c_str()); + } + return m->second; + }); + return queue->get_iface(); +} + /** @brief Returns the amount of links in the platform */ size_t Engine::get_link_count() const {