2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-13 00:12:17 +00:00
Files
fiber/src/properties.cpp
2015-06-19 18:55:02 +02:00

40 lines
1.3 KiB
C++

// Copyright Oliver Kowalke 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "boost/fiber/properties.hpp"
#include <boost/assert.hpp>
#include "boost/fiber/algorithm.hpp"
#include "boost/fiber/fiber_manager.hpp"
#include "boost/fiber/fiber_context.hpp"
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace fibers {
void fiber_properties::notify() {
BOOST_ASSERT( sched_algo_);
// Application code might change an important property for any fiber at
// any time. The fiber in question might be ready, running or waiting.
// Significantly, only a fiber which is ready but not actually running is
// in the sched_algorithm's ready queue. Don't bother the sched_algorithm
// with a change to a fiber it's not currently tracking: it will do the
// right thing next time the fiber is passed to its awakened() method.
if ( fiber_->is_ready() ) {
static_cast< sched_algorithm_with_properties_base * >( sched_algo_)->
property_change_( fiber_, this);
}
}
}} // boost::fibers
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif