Imported Upstream version 1.64.0
[platform/upstream/boost.git] / boost / fiber / detail / data.hpp
1
2 //          Copyright Oliver Kowalke 2013.
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_FIBERS_DETAIL_DATA_H
8 #define BOOST_FIBERS_DETAIL_DATA_H
9
10 #include <boost/config.hpp>
11
12 #include <boost/fiber/detail/config.hpp>
13 #include <boost/fiber/detail/spinlock.hpp>
14
15 #ifdef BOOST_HAS_ABI_HEADERS
16 #  include BOOST_ABI_PREFIX
17 #endif
18
19 namespace boost {
20 namespace fibers {
21
22 class context;
23
24 namespace detail {
25
26 #if (BOOST_EXECUTION_CONTEXT==1)
27 struct data_t {
28     spinlock_lock   *   lk{ nullptr };
29     context         *   ctx{ nullptr };
30
31     data_t() = default;
32
33     explicit data_t( spinlock_lock * lk_) noexcept :
34         lk{ lk_ } {
35     }
36
37     explicit data_t( context * ctx_) noexcept :
38         ctx{ ctx_ } {
39     }
40 };
41 #else
42 struct data_t {
43     spinlock_lock   *   lk{ nullptr };
44     context         *   ctx{ nullptr };
45     context         *   from;
46
47     explicit data_t( context * from_) noexcept :
48         from{ from_ } {
49     }
50
51     explicit data_t( spinlock_lock * lk_,
52                      context * from_) noexcept :
53         lk{ lk_ },
54         from{ from_ } {
55     }
56
57     explicit data_t( context * ctx_,
58                      context * from_) noexcept :
59         ctx{ ctx_ },
60         from{ from_ } {
61     }
62 };
63 #endif
64
65 }}}
66
67 #ifdef BOOST_HAS_ABI_HEADERS
68 #  include BOOST_ABI_SUFFIX
69 #endif
70
71 #endif // BOOST_FIBERS_DETAIL_DATA_H