trampoline_pull.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright Oliver Kowalke 2009.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_COROUTINES_DETAIL_TRAMPOLINE_PULL_H
  6. #define BOOST_COROUTINES_DETAIL_TRAMPOLINE_PULL_H
  7. #include <boost/assert.hpp>
  8. #include <boost/config.hpp>
  9. #include <boost/context/detail/fcontext.hpp>
  10. #include <boost/cstdint.hpp>
  11. #include <boost/coroutine/detail/config.hpp>
  12. #include <boost/coroutine/detail/data.hpp>
  13. #ifdef BOOST_HAS_ABI_HEADERS
  14. # include BOOST_ABI_PREFIX
  15. #endif
  16. namespace boost {
  17. namespace coroutines {
  18. namespace detail {
  19. template< typename Coro >
  20. void trampoline_pull( context::detail::transfer_t t)
  21. {
  22. typedef typename Coro::param_type param_type;
  23. data_t * data = static_cast< data_t * >( t.data);
  24. data->from->ctx_ = t.fctx;
  25. param_type * param(
  26. static_cast< param_type * >( data->data) );
  27. BOOST_ASSERT( 0 != param);
  28. Coro * coro(
  29. static_cast< Coro * >( param->coro) );
  30. BOOST_ASSERT( 0 != coro);
  31. coro->run();
  32. }
  33. }}}
  34. #ifdef BOOST_HAS_ABI_HEADERS
  35. # include BOOST_ABI_SUFFIX
  36. #endif
  37. #endif // BOOST_COROUTINES_DETAIL_TRAMPOLINE_PULL_H