Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 //          Copyright Oliver Kowalke 2014.
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_COROUTINES2_DETAIL_PUSH_CONTROL_BLOCK_HPP
0008 #define BOOST_COROUTINES2_DETAIL_PUSH_CONTROL_BLOCK_HPP
0009 
0010 #include <exception>
0011 
0012 #include <boost/config.hpp>
0013 #include <boost/context/fiber.hpp>
0014 
0015 #include <boost/coroutine2/detail/state.hpp>
0016 
0017 #ifdef BOOST_HAS_ABI_HEADERS
0018 #  include BOOST_ABI_PREFIX
0019 #endif
0020 
0021 namespace boost {
0022 namespace coroutines2 {
0023 namespace detail {
0024 
0025 template< typename T >
0026 struct push_coroutine< T >::control_block {
0027     boost::context::fiber                           c;
0028     typename pull_coroutine< T >::control_block *   other;
0029     state_t                                         state;
0030     std::exception_ptr                              except;
0031 
0032     static void destroy( control_block * cb) noexcept;
0033 
0034     template< typename StackAllocator, typename Fn >
0035     control_block( context::preallocated, StackAllocator &&, Fn &&);
0036 
0037     control_block( typename pull_coroutine< T >::control_block *, boost::context::fiber &) noexcept;
0038 
0039     control_block( control_block &) = delete;
0040     control_block & operator=( control_block &) = delete;
0041 
0042     void deallocate() noexcept;
0043 
0044     void resume( T const&);
0045 
0046     void resume( T &&);
0047 
0048     bool valid() const noexcept;
0049 };
0050 
0051 template< typename T >
0052 struct push_coroutine< T & >::control_block {
0053     boost::context::fiber                               c;
0054     typename pull_coroutine< T & >::control_block   *   other;
0055     state_t                                             state;
0056     std::exception_ptr                                  except;
0057 
0058     static void destroy( control_block * cb) noexcept;
0059 
0060     template< typename StackAllocator, typename Fn >
0061     control_block( context::preallocated, StackAllocator &&, Fn &&);
0062 
0063     control_block( typename pull_coroutine< T & >::control_block *, boost::context::fiber &) noexcept;
0064 
0065     control_block( control_block &) = delete;
0066     control_block & operator=( control_block &) = delete;
0067 
0068     void deallocate() noexcept;
0069 
0070     void resume( T &);
0071 
0072     bool valid() const noexcept;
0073 };
0074 
0075 struct push_coroutine< void >::control_block {
0076     boost::context::fiber                       c;
0077     pull_coroutine< void >::control_block  *    other;
0078     state_t                                     state;
0079     std::exception_ptr                          except;
0080 
0081     static void destroy( control_block * cb) noexcept;
0082 
0083     template< typename StackAllocator, typename Fn >
0084     control_block( context::preallocated, StackAllocator &&, Fn &&);
0085 
0086     control_block( pull_coroutine< void >::control_block *, boost::context::fiber &) noexcept;
0087 
0088     control_block( control_block &) = delete;
0089     control_block & operator=( control_block &) = delete;
0090 
0091     void deallocate() noexcept;
0092 
0093     void resume();
0094 
0095     bool valid() const noexcept;
0096 };
0097 
0098 }}}
0099 
0100 #ifdef BOOST_HAS_ABI_HEADERS
0101 #  include BOOST_ABI_SUFFIX
0102 #endif
0103 
0104 #endif // BOOST_COROUTINES2_DETAIL_PUSH_CONTROL_BLOCK_HPP