]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fiber/include/boost/fiber/properties.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fiber / include / boost / fiber / properties.hpp
CommitLineData
7c673cae
FG
1// Copyright Nat Goodspeed 2014.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// Define fiber_properties, a base class from which a library consumer can
7// derive a subclass with specific properties important to a user-coded
8// scheduler.
9
10#ifndef BOOST_FIBERS_PROPERTIES_HPP
11#define BOOST_FIBERS_PROPERTIES_HPP
12
13#include <boost/fiber/detail/config.hpp>
14
15#ifdef BOOST_HAS_ABI_HEADERS
16# include BOOST_ABI_PREFIX
17#endif
18
19# if defined(BOOST_MSVC)
20# pragma warning(push)
21# pragma warning(disable:4275)
22# endif
23
24namespace boost {
25namespace fibers {
26
27class context;
28
29namespace algo {
30
31struct algorithm;
32
33}
34
35class BOOST_FIBERS_DECL fiber_properties {
36protected:
37 // initialized by constructor
38 context * ctx_;
39 // set every time this fiber becomes READY
40 algo::algorithm * algo_{ nullptr };
41
42 // Inform the relevant algorithm instance that something important
43 // has changed, so it can (presumably) adjust its data structures
44 // accordingly.
45 void notify() noexcept;
46
47public:
48 // Any specific property setter method, after updating the relevant
49 // instance variable, can/should call notify().
50
51 // fiber_properties, and by implication every subclass, must accept a back
52 // pointer to its context.
53 fiber_properties( context * ctx) noexcept :
54 ctx_{ ctx } {
55 }
56
57 // We need a virtual destructor (hence a vtable) because fiber_properties
58 // is stored polymorphically (as fiber_properties*) in context, and
59 // destroyed via that pointer.
60 virtual ~fiber_properties() = default;
61
62 // not really intended for public use, but algorithm_with_properties
63 // must be able to call this
64 void set_algorithm( algo::algorithm * algo) noexcept {
65 algo_ = algo;
66 }
67};
68
69}} // namespace boost::fibers
70
71# if defined(BOOST_MSVC)
72# pragma warning(pop)
73# endif
74
75#ifdef BOOST_HAS_ABI_HEADERS
76# include BOOST_ABI_SUFFIX
77#endif
78
79#endif // BOOST_FIBERS_PROPERTIES_HPP