From 7fe91d33fb590e4bfb5f04d4ec67bfc59f347a73 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Mon, 11 Mar 2024 13:27:27 -0400 Subject: [PATCH] just use executor() for what get_executor() was doing --- include/appbase/application_base.hpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/appbase/application_base.hpp b/include/appbase/application_base.hpp index e074755..825cdec 100644 --- a/include/appbase/application_base.hpp +++ b/include/appbase/application_base.hpp @@ -352,7 +352,7 @@ class application_t : public application_base { */ template auto post(int priority, Func&& func) { - return get_executor().post(priority, std::forward(func)); + return executor().post(priority, std::forward(func)); } /** @@ -360,11 +360,11 @@ class application_t : public application_base { * Should only be executed from one thread. */ void exec() { - application_base::exec(get_executor()); + application_base::exec(executor()); } boost::asio::io_service& get_io_service() { - return get_executor().get_io_service(); + return executor().get_io_service(); } void startup() { @@ -373,19 +373,15 @@ class application_t : public application_base { application_t() : application_base(std::make_shared()) { set_stop_executor_cb([&]() { get_io_service().stop(); }); - set_post_cb([&](int prio, std::function cb) { get_executor().post(prio, std::move(cb)); }); + set_post_cb([&](int prio, std::function cb) { executor().post(prio, std::move(cb)); }); } - executor_t& executor() { - return get_executor(); + executor_t& executor() const { + return *static_cast(executor_ptr.get()); } private: inline static std::unique_ptr app_instance; - - executor_t& get_executor() const { - return *static_cast(executor_ptr.get()); - } };