]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/coroutine2/include/boost/coroutine2/detail/pull_control_block_ecv2.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / coroutine2 / include / boost / coroutine2 / detail / pull_control_block_ecv2.hpp
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_PULL_CONTROL_BLOCK_HPP
8 #define BOOST_COROUTINES2_DETAIL_PULL_CONTROL_BLOCK_HPP
9
10 #include <exception>
11 #include <type_traits>
12
13 #include <boost/config.hpp>
14 #include <boost/context/execution_context.hpp>
15
16 #include <boost/coroutine2/detail/state.hpp>
17
18 #ifdef BOOST_HAS_ABI_HEADERS
19 # include BOOST_ABI_PREFIX
20 #endif
21
22 namespace boost {
23 namespace coroutines2 {
24 namespace detail {
25
26 template< typename T >
27 struct pull_coroutine< T >::control_block {
28 boost::context::execution_context< T * > ctx;
29 typename push_coroutine< T >::control_block * other;
30 state_t state;
31 std::exception_ptr except;
32 bool bvalid;
33 typename std::aligned_storage< sizeof( T), alignof( T) >::type storage;
34
35 static void destroy( control_block * cb) noexcept;
36
37 template< typename StackAllocator, typename Fn >
38 control_block( context::preallocated, StackAllocator, Fn &&);
39
40 control_block( typename push_coroutine< T >::control_block *, boost::context::execution_context< T * > &) noexcept;
41
42 ~control_block();
43
44 control_block( control_block &) = delete;
45 control_block & operator=( control_block &) = delete;
46
47 void deallocate() noexcept;
48
49 void resume();
50
51 void set( T *);
52
53 T & get() noexcept;
54
55 bool valid() const noexcept;
56 };
57
58 template< typename T >
59 struct pull_coroutine< T & >::control_block {
60 boost::context::execution_context< T * > ctx;
61 typename push_coroutine< T & >::control_block * other;
62 state_t state;
63 std::exception_ptr except;
64 T * t;
65
66 static void destroy( control_block * cb) noexcept;
67
68 template< typename StackAllocator, typename Fn >
69 control_block( context::preallocated, StackAllocator, Fn &&);
70
71 control_block( typename push_coroutine< T & >::control_block *, boost::context::execution_context< T * > &) noexcept;
72
73 control_block( control_block &) = delete;
74 control_block & operator=( control_block &) = delete;
75
76 void deallocate() noexcept;
77
78 void resume();
79
80 T & get() noexcept;
81
82 bool valid() const noexcept;
83 };
84
85 struct pull_coroutine< void >::control_block {
86 boost::context::execution_context< void > ctx;
87 push_coroutine< void >::control_block * other;
88 state_t state;
89 std::exception_ptr except;
90
91 static void destroy( control_block * cb) noexcept;
92
93 template< typename StackAllocator, typename Fn >
94 control_block( context::preallocated, StackAllocator, Fn &&);
95
96 control_block( push_coroutine< void >::control_block *, boost::context::execution_context< void > &) noexcept;
97
98 control_block( control_block &) = delete;
99 control_block & operator=( control_block &) = delete;
100
101 void deallocate() noexcept;
102
103 void resume();
104
105 bool valid() const noexcept;
106 };
107
108 }}}
109
110 #ifdef BOOST_HAS_ABI_HEADERS
111 # include BOOST_ABI_SUFFIX
112 #endif
113
114 #endif // BOOST_COROUTINES2_DETAIL_PULL_CONTROL_BLOCK_HPP