mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-08-31 01:31:10 +00:00
* support non-local remote transports * fix LogosResult * allow getting client over specific transport * fix ssl * investiage ssl error * pr comments * allow transport set configuration on any module * pr comments * add docs * pr comments * propagate only non-qt dependencies * restore ABI compatibility
29 lines
580 B
C++
29 lines
580 B
C++
#include "io_context_pool.h"
|
|
|
|
namespace logos::plain {
|
|
|
|
IoContextPool::IoContextPool()
|
|
: m_ioc()
|
|
, m_guard(boost::asio::make_work_guard(m_ioc))
|
|
, m_worker([this]{ m_ioc.run(); })
|
|
{
|
|
}
|
|
|
|
IoContextPool::~IoContextPool()
|
|
{
|
|
// Drop the work guard so run() can return once all outstanding work
|
|
// completes, then stop forcefully if something lingers.
|
|
m_guard.reset();
|
|
m_ioc.stop();
|
|
if (m_worker.joinable())
|
|
m_worker.join();
|
|
}
|
|
|
|
IoContextPool& IoContextPool::shared()
|
|
{
|
|
static IoContextPool pool;
|
|
return pool;
|
|
}
|
|
|
|
} // namespace logos::plain
|