2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-10 23:32:28 +00:00
Commit Graph

37 Commits

Author SHA1 Message Date
Nat Goodspeed
a4e77e502f Re-add bool fiber_manager::preserve_fpu() to header file. 2015-05-11 05:46:26 -04:00
Nat Goodspeed
2687814477 Merge branch 'develop' of github.com:olk/boost-fiber into sched-props-dev
Resolved conflicts:
	doc/condition_variables.qbk
	examples/cpp03/migration/workstealing_round_robin.cpp
	examples/cpp03/migration/workstealing_round_robin.hpp
	include/boost/fiber/algorithm.hpp
	include/boost/fiber/bounded_queue.hpp
	include/boost/fiber/detail/fiber_base.hpp
	include/boost/fiber/detail/fifo.hpp
	include/boost/fiber/detail/waiting_queue.hpp
	include/boost/fiber/detail/worker_fiber.hpp
	include/boost/fiber/fiber.hpp
	include/boost/fiber/fiber_manager.hpp
	include/boost/fiber/fixedsize_stack.hpp
	include/boost/fiber/operations.hpp
	include/boost/fiber/round_robin.hpp
	include/boost/fiber/unbounded_queue.hpp
	src/detail/worker_fiber.cpp
	src/fiber.cpp
	src/fiber_manager.cpp
	src/round_robin.cpp
2015-05-10 22:03:35 -04:00
Oliver Kowalke
aa337b07f7 move 'fm_' - free functions into fiber_manager 2015-02-08 16:02:22 +01:00
Oliver Kowalke
13bf486fea update stack-allocators 2015-02-06 18:29:26 +01:00
Oliver Kowalke
f37d7c5511 store terminated fibers in tqueue 2015-01-15 21:22:10 +01:00
Oliver Kowalke
27c0a78d36 allocate fiber_context on stack 2015-01-13 14:57:32 +01:00
Oliver Kowalke
654127af00 rename fiber_base -> fiber_context and move to public namespace 2015-01-04 16:05:08 +01:00
Oliver Kowalke
0fda6d1f88 remove some warnings 2015-01-04 13:13:15 +01:00
Oliver Kowalke
584dcdceee allocate/deallocate fiber_base via allocator 2014-12-29 17:38:01 +01:00
Oliver Kowalke
44326ebdd3 remove priority 2014-12-28 08:35:44 +01:00
Oliver Kowalke
2f19be6d67 use C++11 2014-12-27 19:07:42 +01:00
Oliver Kowalke
ddbdd91ced use execution_context 2014-11-24 19:58:59 +01:00
Nat Goodspeed
f1a34d297f Remove 'priority' for every fiber, and its support methods.
Priority is another property that's only relevant for future sched_algorithm
implementations. We don't even have an example yet. It's a good candidate for
moving to a specific fiber_properties subclass for that specific
sched_algorithm implementation.
2014-11-11 18:00:18 -05:00
Nat Goodspeed
402a4353f7 Define sched_algorithm methods on fiber_base*, not worker_fiber*.
Some reviewers disliked that to build a custom sched_algorithm subclass, you
must necessarily manipulate pointers to classes in the boost::fibers::detail
namespace. Redefine all such methods to use fiber_base* rather than
detail::worker_fiber*.

Hoist fiber_base* into boost::fibers namespace. We considered an opaque
typedef rather than fiber_base*, but in fact a sched_algorithm subclass may
need is_ready().

Moreover, a sched_algorithm subclass may well want to use an intrusive linked
list to queue fibers. Hoist worker_fiber::nxt_ pointer into fiber_base, and
remove worker_fiber::next() and next_reset() methods. This allows recasting
detail::fifo in terms of fiber_base*, therefore round_robin can be stated
almost entirely in terms of fiber_base* rather than worker_fiber*.

Recast fiber constructor taking worker_fiber* to take fiber_base* instead.
This constructor is used solely for fiber migration; with relevant functions
now returning fiber_base*, we think we no longer need fiber(worker_fiber*).
2014-11-10 21:19:28 -05:00
Nat Goodspeed
3128334364 Initial cut at supporting arbitrary user-coded scheduler properties.
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
2014-11-08 11:03:51 -05:00
Oliver Kowalke
2e4fa3e53f re-factoring of thread_local_ptr<> 2014-10-01 21:40:12 +02:00
Oliver Kowalke
1c3b447716 some fixes 2014-09-26 17:57:53 +02:00
Oliver Kowalke
7483a729aa some fixes 2014-09-25 18:52:04 +02:00
Oliver Kowalke
7fb469cd10 some fixes 2014-09-24 19:18:44 +02:00
Oliver Kowalke
c005bb2c8f doc update 2014-09-09 20:40:26 +02:00
Oliver Kowalke
5ede204812 optimize calling high_resolution_clock::now() 2014-08-17 20:28:40 +02:00
Oliver Kowalke
8df4a56564 use high_resolution_clock 2014-07-07 20:32:56 +02:00
Oliver Kowalke
a2d3eba716 fix migrating a fiber between threads 2014-06-26 19:01:49 +02:00
Oliver Kowalke
db3469526c fm_yield()/fm_join() do suspend active fiber
- in previous version active-fiber is stored in ready-queue
  even if active-fiber is in state RUNNING
-> triggers segmentation faults if fiber gets migrated
2014-06-25 18:24:01 +02:00
Oliver Kowalke
b4b9dbea77 some fixes 2014-06-24 19:49:14 +02:00
Oliver Kowalke
dfeb4ff290 changes to support fier migration
- still not correct
2014-06-23 20:15:02 +02:00
Oliver Kowalke
91ccc91ee7 some fixes 2014-06-22 19:31:58 +02:00
Oliver Kowalke
dabcd39066 add volatile (not working) 2014-06-17 14:35:07 +02:00
Oliver Kowalke
026003bb65 use the free fm_<xyz> - functions 2014-06-17 11:51:14 +02:00
Oliver Kowalke
9ff51ada50 split fiber_manager in data part and free functions 2014-06-17 10:02:43 +02:00
Oliver Kowalke
f4defed2b5 workstealing example 2014-03-25 17:45:56 +01:00
Oliver Kowalke
e031ba4762 move asio-stuff to example section 2014-03-24 19:14:38 +01:00
Oliver Kowalke
ab91ab52b8 changes for boost.asio 2014-03-23 18:20:15 +01:00
Oliver Kowalke
e83ba7f642 add setter/getter for wait-interval of fiber_manager 2014-03-22 20:19:36 +01:00
Oliver Kowalke
2d012334b1 allocate main_fiber inside synch. primitives 2014-03-22 18:22:32 +01:00
Oliver Kowalke
493cb704dc split into fifo and waiting_queue: sleep if nothing to do 2014-03-22 18:09:03 +01:00
Oliver Kowalke
9057a3c365 split round_robin into sched_algorithm + fiber_manager 2014-03-20 20:04:59 +01:00