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

178 Commits

Author SHA1 Message Date
Oliver Kowalke
2173200c14 example simple 2015-09-10 18:07:41 +02:00
Nat Goodspeed
c9bd8360b4 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-09-09 21:47:46 -04: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
513204a75e add termination output to example simple.cpp 2015-09-09 21:11:02 +02:00
Nat Goodspeed
268922a9e6 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-09-09 13:51:50 -04:00
Oliver Kowalke
c89410dfd8 uses intrusive::list<> isntread hand-written queues 2015-09-09 19:22:54 +02:00
Oliver Kowalke
e4fc7e7736 restore simple example 2015-09-08 21:35:46 +02:00
Oliver Kowalke
2cd1d39f12 fix clang compiler error regarding missing typename 2015-09-08 18:58:36 +02:00
Nat Goodspeed
6702d7cb9c Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-09-08 06:21:33 -04:00
Oliver Kowalke
5854743a0a force segfault in work-sharing example 2015-09-07 22:24:20 +02:00
Oliver Kowalke
3200e419d2 increase amount of fibers and threads 2015-09-07 20:58:22 +02:00
Nat Goodspeed
f28b6fc497 Update shared_ready_queue::main_fiber comments. 2015-09-07 14:55:30 -04:00
Nat Goodspeed
6cf8f4627f Update work_sharing to never share a thread's main fiber.
Instead, when the main fiber is passed to awakened(), stash it in a separate
slot and make pick_next() return it only when the shared queue is empty.

Update ready_fibers() to include a non-empty main_fiber slot.
2015-09-07 14:50:55 -04:00
Oliver Kowalke
6499bb07e7 fiber_context renamed to context 2015-09-07 17:23:59 +02:00
Oliver Kowalke
7f97616aa2 Merge branch 'ws' into develop 2015-09-07 17:07:59 +02:00
Oliver Kowalke
4dc5aaab59 add example of work-sharing 2015-09-07 11:53:13 +02:00
Oliver Kowalke
bc044fbed2 stuff 2015-09-06 21:36:06 +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
Nat Goodspeed
bcdb555821 Use std::shared_ptr and std::make_shared for promise_handler.
Publish promise_handler::promise_ptr and use it in asio_handler_invoke() for
consistency.
2015-09-03 08:47:25 -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
5f6df41bc7 first part of formating example wait_stuff 2015-08-31 21:53:47 +02:00
Nat Goodspeed
e3bb470376 Fill in section on adapting to nonblocking I/O. 2015-08-31 11:29:26 -04:00
Nat Goodspeed
2ed2bb4827 Add when_all_members() description. 2015-08-31 10:38:40 -04:00
Nat Goodspeed
f15fccb4b9 Add wait_all_collect_errors() description. 2015-08-31 10:08:31 -04:00
Nat Goodspeed
cc8acb1fee Add wait_all_until_error(), wait_all_until_error_source() description. 2015-08-31 10:00:38 -04:00
Nat Goodspeed
56191d5190 Add wait_all_values(), wait_all_values_source() description. 2015-08-31 08:15:06 -04:00
Nat Goodspeed
5cb215f741 Add wait_all_simple() description. 2015-08-30 20:49:45 -04:00
Nat Goodspeed
53127efe42 Add wait_first_value_het() description. 2015-08-30 19:56:40 -04:00
Nat Goodspeed
ec251c3c02 Add wait_first_success() description. 2015-08-30 19:28:44 -04:00
Nat Goodspeed
bed11fe0a1 Add wait_first_outcome() description. 2015-08-30 18:42:50 -04:00
Nat Goodspeed
2c36b37122 Answered my own question about exception in detached fiber. 2015-08-30 17:41:20 -04:00
Nat Goodspeed
34ec067a1f Add QuickBook markup for wait_first_value() section. 2015-08-29 21:34:55 -04:00
Nat Goodspeed
a8debb9201 Add first when_any passage (wait_first_simple())... work in progress. 2015-08-29 19:42:53 -04:00
Nat Goodspeed
ad1d3d118a Introduce wait_all_members_get() to restore asynchrony.
Passing the futures from the argument-pack functions through a function-call
boundary forces the runtime to perform all the async() calls _first,_ then
make a separate pass through the futures to obtain results.
2015-08-29 14:17:45 -04:00
Nat Goodspeed
9c1b412f7e Naive implementation of wait_all_members() is in fact synchronous. 2015-08-29 14:05:23 -04:00
Nat Goodspeed
f384143d04 Add wait_all_collect_errors() plus example usage. 2015-08-29 13:26:52 -04:00
Nat Goodspeed
5e30a4647b Add wait_all_until_error(), wait_all_until_error_source(), plus examples. 2015-08-29 13:10:01 -04:00
Nat Goodspeed
9c7a0b7bc5 Add wait_all_values(), wait_all_values_source(), plus example usage. 2015-08-29 12:35:25 -04:00
Nat Goodspeed
e9a234d06b Intersperse example calling code with implementations.
Introduce Runner and Example classes to collect and ultimately run lambdas
illustrating use of each different wait_something() variant.

Move Verbose up to the top for use by Runner. Similarly, move sleeper() for
use by those lambdas.

The body of main() then reduces to a Runner::run() call.
2015-08-29 09:08:20 -04:00
Nat Goodspeed
02eb362de5 wait_all_simple() can no longer share wait_first_simple_impl().
Now that wait_first_simple() is again based on Done (a bool protected by a
condition variable) rather than a barrier(2), have to introduce
wait_all_simple_impl() to manage the barrier.
2015-08-29 08:35:46 -04:00
Nat Goodspeed
ab32dbe34a Revert "Remove Done wrapper: fibers::barrier encapsulates that for us."
This reverts commit 59a3afd209, reinstating the
Done wrapper.

While it is true that a barrier(2) will wake up when the second fiber calls
wait(), it then _resets._ This means that the _third_ fiber will wait() for
the fourth, and so on. If an odd number of fibers binds that barrier, the last
of them will hang until shutdown.

We want Done.wait() to wake up on the first notify() call, and for every
subsequent notify() call to be a no-op. Apparently Done is the correct
mechanism after all.
2015-08-29 08:25:40 -04:00
Nat Goodspeed
0c25c3a179 Add wait_all_simple(). Surprisingly like wait_first_simple()! 2015-08-29 02:49:48 +00:00