Commit Graph

38 Commits

Author SHA1 Message Date
oliver Kowalke
bf2b5978d2 fix examples 2017-11-08 13:35:18 +01:00
oliver Kowalke
8d53732808 fix renaming of ready_queue_type in examples 2017-03-03 08:15:38 +01:00
Oliver Kowalke
310f3ce2f2 move sched_algorithm to algo::algorithm
- new namesapce algo
- shared_round_robin with shared ready queue
2016-05-13 20:14:48 +02:00
Nat Goodspeed
85c0d26d11 Fix minor errors in doc generation. 2016-03-23 21:28:40 -04:00
Oliver Kowalke
43eb5bd769 fix example priority.cpp 2016-02-16 11:05:21 +01:00
Nat Goodspeed
78e30d8416 Streamline implementation of priority.cpp's priority_scheduler.
Now that rqueue_ is an STL-compatible container,
priority_scheduler::awakened() can use std::find_if() to search for a context
with a lower priority.

Now that rqueue_ is an intrusive_list, priority_scheduler::property_change()
need not search it: it can simply test with context::ready_is_linked(). Now
that it's a doubly-linked list, we can use context::ready_unlink() to unlink.

Now that method parameters have been renamed from 'f' to 'ctx', change all
references in comments accordingly.
2016-02-15 20:27:44 -05:00
Nat Goodspeed
ea0c16080b A few more documentation-related edits 2016-02-15 17:12:56 -05:00
Oliver Kowalke
59a4317bf3 use condition_variable::wait(lk,pred) 2016-02-02 17:07:29 +01:00
Oliver Kowalke
a4c2315c54 fix examples because autoreset_event was removed 2016-01-25 21:47:58 +01:00
Oliver Kowalke
d541e88a4b update documentation 2015-12-29 15:04:13 +01:00
Oliver Kowalke
726d4d51b9 ++14 polishing 2015-12-01 21:07:11 +01:00
Oliver Kowalke
5357f7038e scheduling-algorithm handles empty ready-queue
- if dispatcher-context detects empty ready-queue
  the scheduler has to be suspended till signaled or
  timeout reached
2015-10-03 09:35:47 +02:00
Oliver Kowalke
253d981f52 examples added 2015-09-29 17:55:46 +02:00
Oliver Kowalke
eafeaaae01 remove examples and tests 2015-09-16 19:12:57 +02:00
Oliver Kowalke
abd1ff524c fixes for signaling interruption and wait 2015-09-11 18:42:16 +02:00
Nat Goodspeed
2b6135364e Make awakened() unconditionally insert fiber.
There was a bug when the ready queue wasn't empty, but there was no
lower-priority fiber already in the queue. In that case the fiber wouldn't be
inserted. We want the loop just to advance the iterator, but to perform the
insert regardless of where the iterator ends up. (With this logic, empty() is
no longer a special case.)

Restore the ~Verbose() message.
2015-09-09 21:46:35 -04:00
Oliver Kowalke
c89410dfd8 uses intrusive::list<> isntread hand-written queues 2015-09-09 19:22:54 +02:00
Oliver Kowalke
6499bb07e7 fiber_context renamed to context 2015-09-07 17:23:59 +02:00
Nat Goodspeed
d653cbdcc6 Finish proofreading pass.
Add a note to the condition_variable::wait_for(..., pred) overload.

fiber_specific_ptr::reset() has no default argument.

Remove mention of launch policy deferred, since no API accepts a launch
policy argument.

Copy construction or copy assignment of a shared_future leaves other.valid()
unchanged. It won't be 'true' unless it was 'true' before.

Mention that [shared_]future::get_exception_ptr() does not invalidate.

Note that 'blocks' and 'suspends' are used interchangeably.

Add some cross-references; add link to std::allocator_arg_t. Clarify the
cross-reference to the paragraph describing BOOST_FIBERS_NO_ATOMICS.

Reformat some overly-long source lines.
2015-09-03 09:16:09 -04:00
Oliver Kowalke
be3d67a109 add end marker to example priority 2015-09-02 20:29:09 +02:00
Oliver Kowalke
52c03cb5fd fix merge error 2015-09-02 19:56:26 +02:00
Oliver Kowalke
ba35ac6de2 update documentation 2015-09-02 19:43:33 +02:00
Oliver Kowalke
a173c047a6 update documentation 2015-09-02 19:41:08 +02:00
Nat Goodspeed
37a0490bbd Fix bug in this_fiber::properties<>().
When the running thread's main fiber calls this_fiber::properties<>() without
yet having passed through sched_algorithm_with_properties::awakened(), which
is what actually instantiates the fiber_properties subclass, you could end up
without a properties instance. Fortunately there's an easy workaround: call
yield().

Remove that workaround from examples/priority.cpp.
2015-09-01 20:21:13 -04:00
Nat Goodspeed
aeaef6510f Reverse advice about when to set the properties for a new fiber.
Change which example code we show for this_fiber::properties<>() and
fiber::properties<>().
2015-09-01 19:55:33 -04:00
Nat Goodspeed
11b06c25dd Fix bug in priority_scheduler::property_change().
The complex logic to make a single pass through the ready queue to find the
old location and also the new insertion point was unfortunately error-prone.
Recast it as two separate passes: a simple search loop to find and unlink the
fiber_context*, then a call to awakened() to reinsert it in the correct place.
2015-09-01 19:16:47 -04:00
Oliver Kowalke
82143be5aa update documentation + formating 2015-09-01 17:32:07 +02:00
Oliver Kowalke
fefffd37eb update documentation 2015-09-01 17:17:38 +02:00
Oliver Kowalke
2601e72673 let sched_algo_ be managed by unique_ptr 2015-08-26 18:59:18 +02:00
Oliver Kowalke
1546533700 examples: priority_scheduler must live long enought
- ~fiber_manager() calls sched_algorithm::pick_next()
- therefore priority_scheudler must live long enough in order to
  be called by ~fiber_manager()
2015-08-26 17:50:12 +02:00
Nat Goodspeed
fd9f16776a Flesh out Customization section with step-by-step directions.
Mark up examples/priority.cpp with code snippets for use in Customization.

Also clarify the effect of changing wait_interval().
2015-08-16 16:38:21 -04:00
Nat Goodspeed
28cbce1256 Eliminate opaque fiber_properties::back_ptr typedef.
It's more straightforward to use the underlying type: fiber_context*.
2015-08-14 16:10:42 -04:00
Nat Goodspeed
0d5ad2adbd Add ready_fibers() override for examples/priority.cpp. 2015-07-31 17:29:33 -04:00
Nat Goodspeed
15a17ca35d Introduce sched_algorithm_with_properties<>::awakened() overload.
sched_algorithm_with_properties<> must intercept awakened() calls before
forwarding control to the subclass override. That pretty much requires two
different virtual methods: one for sched_algorithm subclasses WITHOUT
properties, the other for sched_algorithm_with_properties subclasses.
Originally we used a different name (awakened_props()), but that was
bothersome. It makes more sense to use a different awakened() overload
instead, one that passes in the relevant properties object.

Fix examples/priority.cpp accordingly.

Also delegate instantiation of a new properties object to new_properties()
virtual method. Overriding this method allows you to customize allocation,
instead of sched_algorithm_with_properties<> unconditionally putting the new
properties object on the heap. Validate the new_properties() return value.
2015-06-21 22:39:00 -04:00
Oliver Kowalke
3c7084e359 fix call of execution_context::operator() * exampe priority 2015-05-14 12:11:37 +02:00
Nat Goodspeed
25ccb85d19 Initialize int priority_ properly to 0, not nullptr. 2015-05-13 08:37:32 -04:00
Nat Goodspeed
9c4cdf3438 Desk-checking pass through fiber_properties source code. 2015-05-10 23:35:15 -04:00
Nat Goodspeed
1bec058e77 Move priority.cpp example program to main examples directory.
Since the library no longer supports C++03, the examples/cpp03 subdirectory
has gone away, along with the cpp11 subdirectory.
2015-05-10 22:59:38 -04:00