From 6da6c32279be96ca97be438b6284beabfea1bbf4 Mon Sep 17 00:00:00 2001 From: Lutz Bichler Date: Mon, 16 Feb 2015 12:39:08 +0100 Subject: Do not open a separate thread in "application.start". Renamed main service object (host_io_ to io_). Removed some log messages. --- implementation/runtime/include/application_impl.hpp | 4 ++-- implementation/runtime/src/application_impl.cpp | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp index 70c408d..dc144d6 100644 --- a/implementation/runtime/include/application_impl.hpp +++ b/implementation/runtime/include/application_impl.hpp @@ -86,7 +86,7 @@ public: routing_manager * get_routing_manager() const; private: - void service(boost::asio::io_service &_io); + void service(); inline void update_session() { session_++; if (0 == session_) { @@ -101,7 +101,7 @@ private: std::string name_; std::shared_ptr configuration_; - boost::asio::io_service host_io_; + boost::asio::io_service io_; // Proxy to or the Routing Manager itself std::shared_ptr routing_; diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp index 32c2d0c..b43acb8 100644 --- a/implementation/runtime/src/application_impl.cpp +++ b/implementation/runtime/src/application_impl.cpp @@ -21,7 +21,7 @@ namespace vsomeip { application_impl::application_impl(const std::string &_name) : - name_(_name), routing_(0), signals_(host_io_, SIGINT, SIGTERM) { + name_(_name), routing_(0), signals_(io_, SIGINT, SIGTERM) { } application_impl::~application_impl() { @@ -103,17 +103,14 @@ void application_impl::start() { if (routing_) routing_->start(); - // start the threads that process the io service queues - std::thread its_host_thread( - std::bind(&application_impl::service, this, std::ref(host_io_))); - its_host_thread.join(); + io_.run(); } void application_impl::stop() { if (routing_) routing_->stop(); - host_io_.stop(); + io_.stop(); } void application_impl::offer_service(service_t _service, instance_t _instance, @@ -240,7 +237,7 @@ std::shared_ptr application_impl::get_configuration() const { } boost::asio::io_service & application_impl::get_io() { - return host_io_; + return io_; } void application_impl::on_event(event_type_e _event) { @@ -300,7 +297,6 @@ routing_manager * application_impl::get_routing_manager() const { // Internal void application_impl::service(boost::asio::io_service &_io) { _io.run(); - VSOMEIP_INFO << "Application stopped running..."; } } // namespace vsomeip -- cgit v1.2.1