2222#include < boost/exception/all.hpp>
2323#include < boost/asio/deadline_timer.hpp>
2424#include < boost/asio/io_context.hpp>
25- #include < boost/asio/io_context_strand.hpp>
2625#include < boost/asio/spawn.hpp>
2726#include < boost/asio/steady_timer.hpp>
2827
3332namespace icinga
3433{
3534
35+ using IoStrand = boost::asio::strand<boost::asio::io_context::executor_type>;
36+
3637/* *
3738 * Scope lock for CPU-bound work done in an I/O thread
3839 *
@@ -41,7 +42,7 @@ namespace icinga
4142class CpuBoundWork
4243{
4344public:
44- CpuBoundWork (boost::asio::yield_context yc, boost::asio::io_context::strand &);
45+ CpuBoundWork (boost::asio::yield_context yc, IoStrand &);
4546 CpuBoundWork (const CpuBoundWork&) = delete ;
4647 CpuBoundWork (CpuBoundWork&&) = delete ;
4748 CpuBoundWork& operator =(const CpuBoundWork&) = delete ;
@@ -112,7 +113,7 @@ class IoEngine
112113 * [^2]: https://bugs.llvm.org/show_bug.cgi?id=19177
113114 * [^3]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26461
114115 */
115- BOOST_NOINLINE static bool IsStrandRunningOnThisThread (const boost::asio::io_context::strand & strand)
116+ BOOST_NOINLINE static bool IsStrandRunningOnThisThread (const IoStrand & strand)
116117 {
117118 return strand.running_in_this_thread ();
118119 }
@@ -175,7 +176,7 @@ class IoEngine
175176
176177 std::atomic_uint_fast32_t m_CpuBoundSemaphore;
177178 std::mutex m_CpuBoundWaitingMutex;
178- std::vector<std::pair<boost::asio::io_context::strand , Shared<AsioConditionVariable>::Ptr>> m_CpuBoundWaiting;
179+ std::vector<std::pair<IoStrand , Shared<AsioConditionVariable>::Ptr>> m_CpuBoundWaiting;
179180};
180181
181182class TerminateIoThread : public std ::exception
@@ -255,8 +256,8 @@ class Timeout
255256 * @param onTimeout The callback to invoke when the timeout occurs.
256257 */
257258 template <class OnTimeout >
258- Timeout (boost::asio::io_context::strand & strand, const Timer::duration_type& timeoutFromNow, OnTimeout onTimeout)
259- : m_Timer(strand.context(), timeoutFromNow), m_Cancelled(Shared<Atomic<bool >>::Make(false ))
259+ Timeout (IoStrand & strand, const Timer::duration_type& timeoutFromNow, OnTimeout onTimeout)
260+ : m_Timer(strand.get_inner_executor(). context(), timeoutFromNow), m_Cancelled(Shared<Atomic<bool >>::Make(false ))
260261 {
261262 ASSERT (IoEngine::IsStrandRunningOnThisThread (strand));
262263
0 commit comments