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)
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
10 #ifndef BOOST_FIBERS_PROPERTIES_HPP
11 #define BOOST_FIBERS_PROPERTIES_HPP
13 #include <boost/fiber/detail/config.hpp>
15 #ifdef BOOST_HAS_ABI_HEADERS
16 # include BOOST_ABI_PREFIX
19 # if defined(BOOST_MSVC)
20 # pragma warning(push)
21 # pragma warning(disable:4275)
35 class BOOST_FIBERS_DECL fiber_properties {
37 // initialized by constructor
39 // set every time this fiber becomes READY
40 algo::algorithm * algo_{ nullptr };
42 // Inform the relevant algorithm instance that something important
43 // has changed, so it can (presumably) adjust its data structures
45 void notify() noexcept;
48 // Any specific property setter method, after updating the relevant
49 // instance variable, can/should call notify().
51 // fiber_properties, and by implication every subclass, must accept a back
52 // pointer to its context.
53 fiber_properties( context * ctx) noexcept :
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;
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 {
69 }} // namespace boost::fibers
71 # if defined(BOOST_MSVC)
75 #ifdef BOOST_HAS_ABI_HEADERS
76 # include BOOST_ABI_SUFFIX
79 #endif // BOOST_FIBERS_PROPERTIES_HPP