File indexing completed on 2025-01-18 09:51:19
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_REDIS_HELPER_HPP
0008 #define BOOST_REDIS_HELPER_HPP
0009
0010 #include <boost/asio/cancellation_type.hpp>
0011
0012 namespace boost::redis::detail
0013 {
0014
0015 template <class T>
0016 auto is_cancelled(T const& self)
0017 {
0018 return self.get_cancellation_state().cancelled() != asio::cancellation_type_t::none;
0019 }
0020
0021 #define BOOST_REDIS_CHECK_OP0(X)\
0022 if (ec || redis::detail::is_cancelled(self)) {\
0023 X\
0024 self.complete(!!ec ? ec : asio::error::operation_aborted);\
0025 return;\
0026 }
0027
0028 #define BOOST_REDIS_CHECK_OP1(X)\
0029 if (ec || redis::detail::is_cancelled(self)) {\
0030 X\
0031 self.complete(!!ec ? ec : asio::error::operation_aborted, {});\
0032 return;\
0033 }
0034
0035 }
0036
0037 #endif