]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // Copyright Oliver Kowalke 2014. | |
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) | |
6 | ||
7 | #ifndef BOOST_COROUTINES2_DETAIL_PUSH_CONTROL_BLOCK_HPP | |
8 | #define BOOST_COROUTINES2_DETAIL_PUSH_CONTROL_BLOCK_HPP | |
9 | ||
10 | #include <exception> | |
11 | ||
12 | #include <boost/config.hpp> | |
13 | #include <boost/context/execution_context.hpp> | |
14 | ||
15 | #include <boost/coroutine2/detail/state.hpp> | |
16 | ||
17 | #ifdef BOOST_HAS_ABI_HEADERS | |
18 | # include BOOST_ABI_PREFIX | |
19 | #endif | |
20 | ||
21 | namespace boost { | |
22 | namespace coroutines2 { | |
23 | namespace detail { | |
24 | ||
25 | template< typename T > | |
26 | struct push_coroutine< T >::control_block { | |
27 | boost::context::execution_context< T * > ctx; | |
28 | typename pull_coroutine< T >::control_block * other; | |
29 | state_t state; | |
30 | std::exception_ptr except; | |
31 | ||
32 | static void destroy( control_block * cb) noexcept; | |
33 | ||
34 | template< typename StackAllocator, typename Fn > | |
35 | control_block( context::preallocated, StackAllocator, Fn &&); | |
36 | ||
37 | control_block( typename pull_coroutine< T >::control_block *, boost::context::execution_context< T * > &) noexcept; | |
38 | ||
39 | control_block( control_block &) = delete; | |
40 | control_block & operator=( control_block &) = delete; | |
41 | ||
42 | void deallocate() noexcept; | |
43 | ||
44 | void resume( T const&); | |
45 | ||
46 | void resume( T &&); | |
47 | ||
48 | bool valid() const noexcept; | |
49 | }; | |
50 | ||
51 | template< typename T > | |
52 | struct push_coroutine< T & >::control_block { | |
53 | boost::context::execution_context< T * > ctx; | |
54 | typename pull_coroutine< T & >::control_block * other; | |
55 | state_t state; | |
56 | std::exception_ptr except; | |
57 | ||
58 | static void destroy( control_block * cb) noexcept; | |
59 | ||
60 | template< typename StackAllocator, typename Fn > | |
61 | control_block( context::preallocated, StackAllocator, Fn &&); | |
62 | ||
63 | control_block( typename pull_coroutine< T & >::control_block *, boost::context::execution_context< T * > &) noexcept; | |
64 | ||
65 | control_block( control_block &) = delete; | |
66 | control_block & operator=( control_block &) = delete; | |
67 | ||
68 | void deallocate() noexcept; | |
69 | ||
70 | void resume( T &); | |
71 | ||
72 | bool valid() const noexcept; | |
73 | }; | |
74 | ||
75 | struct push_coroutine< void >::control_block { | |
76 | boost::context::execution_context< void > ctx; | |
77 | pull_coroutine< void >::control_block * other; | |
78 | state_t state; | |
79 | std::exception_ptr except; | |
80 | ||
81 | static void destroy( control_block * cb) noexcept; | |
82 | ||
83 | template< typename StackAllocator, typename Fn > | |
84 | control_block( context::preallocated, StackAllocator, Fn &&); | |
85 | ||
86 | control_block( pull_coroutine< void >::control_block *, boost::context::execution_context< void > &) noexcept; | |
87 | ||
88 | control_block( control_block &) = delete; | |
89 | control_block & operator=( control_block &) = delete; | |
90 | ||
91 | void deallocate() noexcept; | |
92 | ||
93 | void resume(); | |
94 | ||
95 | bool valid() const noexcept; | |
96 | }; | |
97 | ||
98 | }}} | |
99 | ||
100 | #ifdef BOOST_HAS_ABI_HEADERS | |
101 | # include BOOST_ABI_SUFFIX | |
102 | #endif | |
103 | ||
104 | #endif // BOOST_COROUTINES2_DETAIL_PUSH_CONTROL_BLOCK_HPP |