2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-17 13:42:21 +00:00
Commit Graph

334 Commits

Author SHA1 Message Date
Nat Goodspeed
f5d136d974 Restore (merge-clobbered?) detach, join, interrupt method decls. 2015-05-13 08:38:28 -04:00
Nat Goodspeed
89b3dafd5c Eliminate spurious whitespace differences from upstream develop. 2015-05-11 09:48:23 -04:00
Nat Goodspeed
77a443b03b Merge branch 'develop' of github.com:olk/boost-fiber into sched-props-dev 2015-05-11 05:51:14 -04:00
Nat Goodspeed
a4e77e502f Re-add bool fiber_manager::preserve_fpu() to header file. 2015-05-11 05:46:26 -04:00
Nat Goodspeed
765014daee working our way through build errors 2015-05-11 05:38:45 -04:00
Nat Goodspeed
4eaed2a943 Start resolving build errors with newly-merged sched-props-dev branch.
Get fiber_manager out of the business of casting returned properties: that
introduces a circular dependency. Defer casting to fiber_properties subclass
to consumers in fiber.hpp and operations.hpp.
2015-05-11 04:25:05 -04:00
Nat Goodspeed
9c4cdf3438 Desk-checking pass through fiber_properties source code. 2015-05-10 23:35:15 -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
Benjamin Worpitz
70c16383b7 Remove definition of BOOST_FIBERS_USE_VARIADIC_FIBER
Since the usage of variadic templates is now enabled by default and not emulated, the definition of the `BOOST_FIBERS_USE_VARIADIC_FIBER` macro can be removed.
2015-04-30 09:02:30 +02:00
Oliver Kowalke
6f5757ff8a adapt new API of execution_context 2015-03-26 10:04:06 +01:00
Oliver Kowalke
eeaf6d3136 Update segmented_stack.hpp 2015-02-19 08:20:43 +01:00
Oliver Kowalke
1bd3e29ff8 rename execution_context::jump_to() -> execution_context::resume() 2015-02-18 18:53:51 +01:00
Oliver Kowalke
09123e20ad remove unecessary fiber ctor 2015-02-14 11:10:46 +01:00
Oliver Kowalke
91c237666e use C++14 features
- lambda capture expressions supports move-only types
- parameters are packed into std::tuple<> and with context-function
  moved to the context-lambda (->lambda capture expression)
- in context-lambda context-function with packed parameters called
  (-> deferred call)
2015-02-11 20:13:00 +01:00
Oliver Kowalke
aa337b07f7 move 'fm_' - free functions into fiber_manager 2015-02-08 16:02:22 +01:00
Oliver Kowalke
5a0f9394e8 Merge branch 'ctx-onstack-lambda' into develop
Conflicts:
	examples/cpp03/migration/workstealing_round_robin.cpp
	include/boost/fiber/bounded_queue.hpp
	include/boost/fiber/detail/worker_fiber.hpp
	include/boost/fiber/unbounded_queue.hpp
	src/detail/worker_fiber.cpp
2015-02-06 18:32:35 +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
f22ae8ba53 use lambda as fiber-fn 2015-01-13 15:15:59 +01:00
Oliver Kowalke
27c0a78d36 allocate fiber_context on stack 2015-01-13 14:57:32 +01:00
Oliver Kowalke
9b7b0be903 Revert "improve spinlock algorithm"
This reverts commit 08f3b52193.
2015-01-10 21:21:05 +01:00
Oliver Kowalke
08f3b52193 improve spinlock algorithm 2015-01-10 21:20:31 +01:00
Oliver Kowalke
fbe98be71e std::copy_exception is deprecated (use std::make_exception_ptr) 2015-01-05 19:57:51 +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
3b332c17ee variadric arguments 2015-01-01 14:40:39 +01:00
Oliver Kowalke
584dcdceee allocate/deallocate fiber_base via allocator 2014-12-29 17:38:01 +01:00
Oliver Kowalke
6a652b8cd7 use std::forward() for rvalues 2014-12-28 22:03:09 +01:00
Oliver Kowalke
f6c7ab7826 rename (un)bounded_queue -> (un)bounded_channel + use allocator 2014-12-28 21:30:14 +01:00
Oliver Kowalke
44326ebdd3 remove priority 2014-12-28 08:35:44 +01:00
Oliver Kowalke
4d1f12e333 extend async() to accept a stack-allocator 2014-12-28 08:07:31 +01:00
Oliver Kowalke
0bd0062789 correct forward declaration of scheduler 2014-12-27 21:16:58 +01:00
Oliver Kowalke
e1698b64a3 static-cast to int for errc 2014-12-27 21:16:36 +01:00
Oliver Kowalke
7f7f01098b make main-fiber thread affine 2014-12-27 21:16:03 +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
Oliver Kowalke
9bd1c0cd0f Nat Goodspeed: optimize fifo + waiting_queue 2014-11-24 19:18:18 +01:00
Oliver Kowalke
81ec70bcef optimize queues : from Nat Goodspeed 2014-11-24 18:11:37 +01:00
Oliver Kowalke
e29cc6dc81 use correct eader for thread_specific_ptr<> 2014-11-24 18:11:22 +01:00
Oliver Kowalke
6fc2b57f23 use thread_specific_ptr 2014-11-24 18:11:08 +01:00
Oliver Kowalke
691aafd839 Nat Goodspeed: Reimplement waiting_queue; Simplify fifo 2014-11-23 19:23:08 +01:00
Oliver Kowalke
ba3c0bb806 optimize queues : from Nat Goodspeed 2014-11-22 11:23:18 +01:00
Oliver Kowalke
ea709758cb use correct eader for thread_specific_ptr<> 2014-11-22 11:22:41 +01:00
Oliver Kowalke
4cc6e72fae use thread_specific_ptr 2014-11-20 18:36:09 +01:00
Oliver Kowalke
7b35699b6e Revert "Nat Goodspeed:"
This reverts commit 1e751d7dbf.
2014-11-20 18:17:08 +01:00
Nat Goodspeed
cb7b5ddd25 Introduce sched_algorithm_with_properties::awakened_props() method.
Every sched_algorithm_with_properties<PROPS> subclass awakened() call must
ensure that control reaches sched_algorithm_with_properties<PROPS>::awakened()
_before_ any logic in the subclass method attempts to access properties. This
turns out to be all too easy to forget.

So instead, advise subclasses to overrride new awakened_props() method. Base-
class method sets things up and then calls awakened_props(). Moreover, when
the compiler supports it, sched_algorithm_with_properties<PROPS>::awakened()
is now marked 'final' to remind subclass authors to override awakened_props()
instead.
2014-11-19 10:40:31 -05:00
Nat Goodspeed
c9e4ec881b Fix bug in fiber::properties() method.
fm_properties() doesn't accept a boost::intrusive_ptr. Pass raw worker_fiber*
instead.
2014-11-19 10:20:52 -05:00
Nat Goodspeed
3595857849 property_change() method doesn't really belong in sched_algorithm.
sched_algorithm knows nothing about properties, so that class isn't really the
best place for the property_change() virtual method. Introduce intermediate
sched_algorithm_with_properties_base class, which introduces property_change_()
virtual method accepting fiber_properties*. Then the properties-specific
sched_algorithm_with_properties<PROPS> implementation calls property_change()
(no trailing underscore) with fiber_properties* cast to PROPS&. Thus the user-
coded sched_algorithm implementation can override property_change() and accept
PROPS& rather than the generic fiber_properties* pointer. But
fiber_properties::notify() -- which doesn't know its own PROPS subclass -- can
nonetheless call sched_algorithm_with_properties_base::property_change_().
2014-11-14 09:58:48 -05:00
Oliver Kowalke
1e751d7dbf Nat Goodspeed:
- Change some doc references from 'algorithm' to 'sched_algorithm'.
- Initial cut at supporting arbitrary user-coded scheduler properties.
- Set fiber_properties::sched_algo_ every time through awakened().
- Define sched_algorithm methods on fiber_base*, not worker_fiber*.
- Simplify detail::fifo by making tail_ point to last link pointer.
- Reimplement waiting_queue::push() using pointer-to-pointer trick.
- Reimplement waiting_queue::move_to() using fiber_base** scan.
- Make bounded_queue::tail_ a ptr* to simplify appending new nodes.
- Make unbounded_queue::tail_ a ptr* to simplify linking new nodes.
- Remove thread_affinity flag and access methods.
- Re-add thread_affinity specific to workstealing_round_robin.
- Remove 'priority' for every fiber, and its support methods.
2014-11-12 20:03:12 +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
757d692cae Re-add thread_affinity specific to workstealing_round_robin.
thread_affinity is a good example of a property relevant only to a particular
sched_algorithm implementation. In examples/cpp03/migration, introduce an
'affinity' subclass of fiber_properties with a thread_affinity data
member.

Derive workstealing_round_robin from sched_algorithm_with_properties<affinity>
and, as required by that base class, forward awakened() calls to base-class
awakened() method.

Reimplement workstealing_round_robin's queue from a std::deque to a "by hand"
intrusive singly-linked list so we can efficiently remove an arbitrary item.
Make steal() method, instead of always popping the last item, scan the list to
find the last item willing to migrate (! thread_affinity).

From examples/cpp03/migration/workstealing_round_robin.hpp, an example of a
user-supplied sched_algorithm implementation, remove all boost/fiber/detail
 #includes. These should no longer be needed.

Change sched_algorithm_with_properties::properties(worker_fiber*) method to
accept fiber_base* instead. The original signature was introduced when every
sched_algorithm implementation necessarily manipulated worker_fiber* pointers.
Now we're intentionally avoiding the need.

For the same reason, introduce a fiber_properties::back_ptr typedef so
subclasses can opaquely pass such pointers through their own constructor to
the base-class constructor.
2014-11-11 16:15:25 -05:00