mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-12 12:02:54 +00:00
Introduce fiber_properties class from which to derive a specific properties class for a particular user-coded sched_algorithm subclass. Add sched_algorithm::property_change(worker_fiber*, fiber_properties*) method to allow a fiber_properties subclass method to notify the sched_algorithm subclass of a change in a relevant property. This generalizes the present priority() method. Introduce sched_algorithm_with_properties<PROPS> template class from which to derive a user-coded scheduler that uses fiber_properties subclass PROPS. Give it ref-returning properties(fiber::id) and properties(worker_fiber*) methods. Introduce fiber_properties* field in worker_fiber, and initialize it to 0. Delete it when the worker_fiber is destroyed. Give it pointer-flavored access methods. Normally this field will remain 0; but the first time the worker_fiber is passed to a sched_algorithm_with_properties<PROPS> subclass, its awakened() method will instantiate the relevant PROPS subclass. Add ref-returning fiber::properties<PROPS>() method. Calling this method presumes that the current thread's sched_algorithm is derived from sched_algorithm_with_properties<PROPS>. Also add this_fiber::properties<PROPS>() with the same restriction. Add ref-returning fm_properties<PROPS>() functions to implement fiber::properties<PROPS>() and this_fiber::properties<PROPS>(). Allow sched_algorithm_with_properties to extract the worker_fiber* from a fiber::id (aka worker_fiber::id) so it can present public-facing properties(id) method as well as properties(worker_fiber*) method. (cherry picked from commit 18c7f2c13b9642826b42aa3f6fa0a6642fce9cbc) Conflicts: include/boost/fiber/detail/worker_fiber.hpp include/boost/fiber/fiber_manager.hpp