]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_boost_asio_yield.h
2 // copy of needed macors from yield.hpp
4 // Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 // Distributed under the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 #ifndef RGW_BOOST_ASIO_YIELD_H
11 #define RGW_BOOST_ASIO_YIELD_H
13 #ifdef HAVE_BOOST_ASIO_COROUTINE
14 #include <boost/asio/yield.hpp>
16 #define BOOST_ASIO_CORO_REENTER(c) \
17 switch (::boost::asio::detail::coroutine_ref _coro_value = c) \
18 case -1: if (_coro_value) \
20 goto terminate_coroutine; \
21 terminate_coroutine: \
23 goto bail_out_of_coroutine; \
24 bail_out_of_coroutine: \
29 #define BOOST_ASIO_CORO_YIELD_IMPL(n) \
30 for (_coro_value = (n);;) \
31 if (_coro_value == 0) \
37 switch (_coro_value ? 0 : 1) \
39 case -1: if (_coro_value) \
40 goto terminate_coroutine; \
42 case 1: if (_coro_value) \
43 goto bail_out_of_coroutine; \
46 #define BOOST_ASIO_CORO_FORK_IMPL(n) \
47 for (_coro_value = -(n);; _coro_value = (n)) \
48 if (_coro_value == (n)) \
56 # define BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD_IMPL(__COUNTER__ + 1)
57 # define BOOST_ASIO_CORO_FORK BOOST_ASIO_CORO_FORK_IMPL(__COUNTER__ + 1)
58 #else // defined(_MSC_VER)
59 # define BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD_IMPL(__LINE__)
60 # define BOOST_ASIO_CORO_FORK BOOST_ASIO_CORO_FORK_IMPL(__LINE__)
61 #endif // defined(_MSC_VER)
64 # define reenter(c) BOOST_ASIO_CORO_REENTER(c)
68 # define yield BOOST_ASIO_CORO_YIELD
72 # define fork BOOST_ASIO_CORO_FORK
75 #endif // HAVE_BOOST_ASIO_COROUTINE
77 #endif // RGW_BOOST_ASIO_YIELD_H