diff options
Diffstat (limited to 'boost/coroutine2/detail/pull_control_block.hpp')
-rw-r--r-- | boost/coroutine2/detail/pull_control_block.hpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/boost/coroutine2/detail/pull_control_block.hpp b/boost/coroutine2/detail/pull_control_block.hpp index 1abb34a0db..7009454c88 100644 --- a/boost/coroutine2/detail/pull_control_block.hpp +++ b/boost/coroutine2/detail/pull_control_block.hpp @@ -8,6 +8,7 @@ #define BOOST_COROUTINES2_DETAIL_PULL_CONTROL_BLOCK_HPP #include <exception> +#include <type_traits> #include <boost/config.hpp> #include <boost/context/execution_context.hpp> @@ -22,17 +23,18 @@ namespace detail { template< typename T > struct pull_coroutine< T >::control_block { - typename push_coroutine< T >::control_block * other; - boost::context::execution_context caller; - boost::context::execution_context callee; - bool preserve_fpu; - int state; - std::exception_ptr except; + typename push_coroutine< T >::control_block * other; + boost::context::execution_context ctx; + bool preserve_fpu; + int state; + std::exception_ptr except; + bool bvalid; + typename std::aligned_storage< sizeof( T), alignof( T) >::type storage[1]; template< typename StackAllocator, typename Fn > control_block( context::preallocated, StackAllocator, Fn &&, bool); - explicit control_block( typename push_coroutine< T >::control_block *); + explicit control_block( typename push_coroutine< T >::control_block *, boost::context::execution_context const&); ~control_block(); @@ -41,22 +43,26 @@ struct pull_coroutine< T >::control_block { void resume(); + void set( T *); + + T & get(); + bool valid() const noexcept; }; template< typename T > struct pull_coroutine< T & >::control_block { typename push_coroutine< T & >::control_block * other; - boost::context::execution_context caller; - boost::context::execution_context callee; + boost::context::execution_context ctx; bool preserve_fpu; int state; std::exception_ptr except; + T * t; template< typename StackAllocator, typename Fn > control_block( context::preallocated, StackAllocator, Fn &&, bool); - explicit control_block( typename push_coroutine< T & >::control_block *); + explicit control_block( typename push_coroutine< T & >::control_block *, boost::context::execution_context const&); ~control_block(); @@ -65,13 +71,14 @@ struct pull_coroutine< T & >::control_block { void resume(); + T & get(); + bool valid() const noexcept; }; struct pull_coroutine< void >::control_block { push_coroutine< void >::control_block * other; - boost::context::execution_context caller; - boost::context::execution_context callee; + boost::context::execution_context ctx; bool preserve_fpu; int state; std::exception_ptr except; @@ -79,7 +86,7 @@ struct pull_coroutine< void >::control_block { template< typename StackAllocator, typename Fn > control_block( context::preallocated, StackAllocator, Fn &&, bool); - explicit control_block( push_coroutine< void >::control_block *); + explicit control_block( push_coroutine< void >::control_block *, boost::context::execution_context const&); ~control_block(); |