1 #ifndef RAD_IO_EXECUTOR_HPP_
2 #define RAD_IO_EXECUTOR_HPP_
4 #include <boost/asio/io_context.hpp>
14 explicit IoExecutor(boost::asio::io_context& ctx) : m_io_context(&ctx) {}
26 return m_io_context->stopped();
29 template <
typename Closure>
31 return m_io_context->post(std::move(closure));
35 return m_io_context->poll_one();
45 boost::asio::io_context* m_io_context;
Adapts boost::asio::io_context into a compatible boost::thread Executor type.
IoExecutor(boost::asio::io_context &ctx)
IoExecutor(IoExecutor const &)=delete
IoExecutor & operator=(IoExecutor &)=delete
IoExecutor & operator=(IoExecutor &&)=default
boost::asio::io_context & get_io_context() noexcept
Not part of the boost::thread::executor concept.
void submit(Closure &&closure)
IoExecutor(IoExecutor &&)=default