1// Copyright Oliver Kowalke 2013.
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#include "boost/fiber/properties.hpp"
7
8#include <boost/assert.hpp>
9
10#include "boost/fiber/algo/algorithm.hpp"
11#include "boost/fiber/scheduler.hpp"
12#include "boost/fiber/context.hpp"
13
14#ifdef BOOST_HAS_ABI_HEADERS
15# include BOOST_ABI_PREFIX
16#endif
17
18namespace boost {
19namespace fibers {
20
21void
22fiber_properties::notify() noexcept {
23 BOOST_ASSERT( nullptr != algo_);
24 // Application code might change an important property for any fiber at
25 // any time. The fiber in question might be ready, running or waiting.
26 // Significantly, only a fiber which is ready but not actually running is
27 // in the sched_algorithm's ready queue. Don't bother the sched_algorithm
28 // with a change to a fiber it's not currently tracking: it will do the
29 // right thing next time the fiber is passed to its awakened() method.
30 if ( ctx_->ready_is_linked() ) {
31 dynamic_cast< algo::algorithm_with_properties_base * >( algo_)->
32 property_change_( ctx: ctx_, props: this);
33 }
34}
35
36}} // boost::fibers
37
38#ifdef BOOST_HAS_ABI_HEADERS
39# include BOOST_ABI_SUFFIX
40#endif
41

source code of boost/libs/fiber/src/properties.cpp