Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:32

0001 
0002 //          Copyright Oliver Kowalke 2009.
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //    (See accompanying file LICENSE_1_0.txt or copy at
0005 //          http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_COROUTINES_DETAIL_TRAMPOLINE_H
0008 #define BOOST_COROUTINES_DETAIL_TRAMPOLINE_H
0009 
0010 #include <boost/assert.hpp>
0011 #include <boost/config.hpp>
0012 #include <boost/context/detail/fcontext.hpp>
0013 #include <boost/cstdint.hpp>
0014 
0015 #include <boost/coroutine/detail/config.hpp>
0016 #include <boost/coroutine/detail/data.hpp>
0017 
0018 #ifdef BOOST_HAS_ABI_HEADERS
0019 #  include BOOST_ABI_PREFIX
0020 #endif
0021 
0022 namespace boost {
0023 namespace coroutines {
0024 namespace detail {
0025 
0026 template< typename Coro >
0027 void trampoline( context::detail::transfer_t t)
0028 {
0029     typedef typename Coro::param_type   param_type;
0030 
0031     data_t * data = static_cast< data_t * >( t.data);
0032     data->from->ctx_ = t.fctx;
0033     param_type * param(
0034         static_cast< param_type * >( data->data) );
0035     BOOST_ASSERT( 0 != param);
0036     BOOST_ASSERT( 0 != param->data);
0037 
0038     Coro * coro(
0039         static_cast< Coro * >( param->coro) );
0040     BOOST_ASSERT( 0 != coro);
0041 
0042     coro->run( param->data);
0043 }
0044 
0045 template< typename Coro >
0046 void trampoline_void( context::detail::transfer_t t)
0047 {
0048     typedef typename Coro::param_type   param_type;
0049 
0050     data_t * data = static_cast< data_t * >( t.data);
0051     data->from->ctx_ = t.fctx;
0052     param_type * param(
0053         static_cast< param_type * >( data->data) );
0054     BOOST_ASSERT( 0 != param);
0055 
0056     Coro * coro(
0057         static_cast< Coro * >( param->coro) );
0058     BOOST_ASSERT( 0 != coro);
0059     
0060     coro->run();
0061 }
0062 
0063 }}}
0064 
0065 #ifdef BOOST_HAS_ABI_HEADERS
0066 #  include BOOST_ABI_SUFFIX
0067 #endif
0068 
0069 #endif // BOOST_COROUTINES_DETAIL_TRAMPOLINE_H