File indexing completed on 2025-01-18 09:30:32
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_COROUTINES_DETAIL_TRAMPOLINE_PUSH_H
0008 #define BOOST_COROUTINES_DETAIL_TRAMPOLINE_PUSH_H
0009
0010 #include <cstddef>
0011
0012 #include <boost/assert.hpp>
0013 #include <boost/config.hpp>
0014 #include <boost/context/detail/fcontext.hpp>
0015 #include <boost/cstdint.hpp>
0016 #include <boost/exception_ptr.hpp>
0017 #include <boost/move/move.hpp>
0018
0019 #include <boost/coroutine/detail/config.hpp>
0020 #include <boost/coroutine/detail/data.hpp>
0021 #include <boost/coroutine/detail/flags.hpp>
0022 #include <boost/coroutine/detail/parameters.hpp>
0023 #include <boost/coroutine/detail/setup.hpp>
0024 #include <boost/coroutine/detail/setup.hpp>
0025 #include <boost/coroutine/exceptions.hpp>
0026 #include <boost/coroutine/flags.hpp>
0027
0028 #ifdef BOOST_HAS_ABI_HEADERS
0029 # include BOOST_ABI_PREFIX
0030 #endif
0031
0032 namespace boost {
0033 namespace coroutines {
0034 namespace detail {
0035
0036 template< typename Coro >
0037 void trampoline_push( context::detail::transfer_t t)
0038 {
0039 typedef typename Coro::param_type param_type;
0040
0041 data_t * data = static_cast< data_t * >( t.data);
0042 data->from->ctx_ = t.fctx;
0043 param_type * param(
0044 static_cast< param_type * >( data->data) );
0045 BOOST_ASSERT( 0 != param);
0046 BOOST_ASSERT( 0 != param->data);
0047
0048 Coro * coro(
0049 static_cast< Coro * >( param->coro) );
0050 BOOST_ASSERT( 0 != coro);
0051
0052 coro->run( param->data);
0053 }
0054
0055 template< typename Coro >
0056 void trampoline_push_void( context::detail::transfer_t t)
0057 {
0058 typedef typename Coro::param_type param_type;
0059
0060 data_t * data = static_cast< data_t * >( t.data);
0061 data->from->ctx_ = t.fctx;
0062 param_type * param(
0063 static_cast< param_type * >( data->data) );
0064 BOOST_ASSERT( 0 != param);
0065
0066 Coro * coro(
0067 static_cast< Coro * >( param->coro) );
0068 BOOST_ASSERT( 0 != coro);
0069
0070 coro->run();
0071 }
0072
0073 }}}
0074
0075 #ifdef BOOST_HAS_ABI_HEADERS
0076 # include BOOST_ABI_SUFFIX
0077 #endif
0078
0079 #endif