|
|
|||
File indexing completed on 2026-08-17 09:00:17
0001 // 0002 // Copyright (c) 2025 Marcelo Zimbres Silva (mzimbres@gmail.com), 0003 // Ruben Perez Hidalgo (rubenperez038 at gmail dot com) 0004 // 0005 // Distributed under the Boost Software License, Version 1.0. (See accompanying 0006 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0007 // 0008 0009 #ifndef BOOST_REDIS_DETAIL_COROUTINE_HPP 0010 #define BOOST_REDIS_DETAIL_COROUTINE_HPP 0011 0012 // asio::coroutine uses __COUNTER__ internally, which can trigger 0013 // ODR violations if we use them in header-only code. These manifest as 0014 // extremely hard-to-debug bugs only present in release builds. 0015 // Use this instead when doing coroutines in non-template code. 0016 // Adapted from Boost.MySQL. 0017 0018 // Coroutine state is represented as an integer (resume_point_var). 0019 // Every yield gets assigned a unique value (resume_point_id). 0020 // Yielding sets the next resume point, returns, and sets a case label for re-entering. 0021 // Coroutines need to switch on resume_point_var to re-enter. 0022 0023 // Enclosing this in a scope allows placing the macro inside a brace-less for/while loop 0024 // The empty scope after the case label is required because labels can't be at the end of a compound statement 0025 #define BOOST_REDIS_YIELD(resume_point_var, resume_point_id, ...) \ 0026 { \ 0027 resume_point_var = resume_point_id; \ 0028 return {__VA_ARGS__}; \ 0029 case resume_point_id: \ 0030 { \ 0031 } \ 0032 } 0033 0034 #define BOOST_REDIS_CORO_INITIAL case 0: 0035 0036 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|