minor fixes

Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
This commit is contained in:
Pratik Mankawde
2026-02-16 17:12:57 +00:00
parent cb40ed6f40
commit e55c4969f3
3 changed files with 14 additions and 1 deletions

View File

@@ -235,7 +235,7 @@ public:
//--------------------------------------------------------------------------
ApplicationImp(std::unique_ptr<Config> config, std::unique_ptr<Logs> logs, std::unique_ptr<TimeKeeper> timeKeeper)
: BasicApp(numberOfThreads(*config))
: BasicApp(numberOfThreads(*config), DeferStart{})
, config_(std::move(config))
, logs_(std::move(logs))
, timeKeeper_(std::move(timeKeeper))

View File

@@ -5,6 +5,12 @@
#include <boost/asio/executor_work_guard.hpp>
BasicApp::BasicApp(std::size_t numberOfThreads) : numberOfThreads_(numberOfThreads)
{
work_.emplace(boost::asio::make_work_guard(io_context_));
startIOThreads();
}
BasicApp::BasicApp(std::size_t numberOfThreads, DeferStart) : numberOfThreads_(numberOfThreads)
{
work_.emplace(boost::asio::make_work_guard(io_context_));
}

View File

@@ -26,6 +26,13 @@ public:
}
protected:
// Construct without starting threads. Derived classes must call
// startIOThreads() once construction is complete.
struct DeferStart
{
};
BasicApp(std::size_t numberOfThreads, DeferStart);
void
startIOThreads();
};