aboutsummaryrefslogtreecommitdiff
path: root/src/common/Asio/IoContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/Asio/IoContext.h')
-rw-r--r--src/common/Asio/IoContext.h28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/common/Asio/IoContext.h b/src/common/Asio/IoContext.h
index ee69fa93b9b..b26de194b5c 100644
--- a/src/common/Asio/IoContext.h
+++ b/src/common/Asio/IoContext.h
@@ -18,18 +18,8 @@
#ifndef IoContext_h__
#define IoContext_h__
-#include <boost/version.hpp>
-
-#if BOOST_VERSION >= 106600
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
-#define IoContextBaseNamespace boost::asio
-#define IoContextBase io_context
-#else
-#include <boost/asio/io_service.hpp>
-#define IoContextBaseNamespace boost::asio
-#define IoContextBase io_service
-#endif
namespace Trinity
{
@@ -41,38 +31,28 @@ namespace Trinity
IoContext() : _impl() { }
explicit IoContext(int concurrency_hint) : _impl(concurrency_hint) { }
- operator IoContextBaseNamespace::IoContextBase&() { return _impl; }
- operator IoContextBaseNamespace::IoContextBase const&() const { return _impl; }
+ operator boost::asio::io_context&() { return _impl; }
+ operator boost::asio::io_context const&() const { return _impl; }
std::size_t run() { return _impl.run(); }
void stop() { _impl.stop(); }
-#if BOOST_VERSION >= 106600
boost::asio::io_context::executor_type get_executor() noexcept { return _impl.get_executor(); }
-#endif
private:
- IoContextBaseNamespace::IoContextBase _impl;
+ boost::asio::io_context _impl;
};
template<typename T>
- inline decltype(auto) post(IoContextBaseNamespace::IoContextBase& ioContext, T&& t)
+ inline decltype(auto) post(boost::asio::io_context& ioContext, T&& t)
{
-#if BOOST_VERSION >= 106600
return boost::asio::post(ioContext, std::forward<T>(t));
-#else
- return ioContext.post(std::forward<T>(t));
-#endif
}
template<typename T>
inline decltype(auto) get_io_context(T&& ioObject)
{
-#if BOOST_VERSION >= 106600
return ioObject.get_executor().context();
-#else
- return ioObject.get_io_service();
-#endif
}
}
}