2 // Copyright Oliver Kowalke 2009.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef BOOST_COROUTINES_DETAIL_TRAMPOLINE_H
8 #define BOOST_COROUTINES_DETAIL_TRAMPOLINE_H
10 #include <boost/assert.hpp>
11 #include <boost/config.hpp>
12 #include <boost/cstdint.hpp>
14 #include <boost/coroutine/detail/config.hpp>
16 #ifdef BOOST_HAS_ABI_HEADERS
17 # include BOOST_ABI_PREFIX
21 namespace coroutines {
24 template< typename Coro >
25 void trampoline( intptr_t vp)
27 typedef typename Coro::param_type param_type;
29 BOOST_ASSERT( 0 != vp);
32 reinterpret_cast< param_type * >( vp) );
33 BOOST_ASSERT( 0 != param);
34 BOOST_ASSERT( 0 != param->data);
37 reinterpret_cast< Coro * >( param->coro) );
38 BOOST_ASSERT( 0 != coro);
40 coro->run( param->data);
43 template< typename Coro >
44 void trampoline_void( intptr_t vp)
46 typedef typename Coro::param_type param_type;
48 BOOST_ASSERT( 0 != vp);
51 reinterpret_cast< param_type * >( vp) );
52 BOOST_ASSERT( 0 != param);
55 reinterpret_cast< Coro * >( param->coro) );
56 BOOST_ASSERT( 0 != coro);
63 #ifdef BOOST_HAS_ABI_HEADERS
64 # include BOOST_ABI_SUFFIX
67 #endif // BOOST_COROUTINES_DETAIL_TRAMPOLINE_H