2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-19 02:12:24 +00:00
Commit Graph

1248 Commits

Author SHA1 Message Date
Nat Goodspeed
cba1a74b70 Eliminate yield_hop_t, therefore yield_base type.
The whole yield / yield_hop dichotomy becomes much easier to read and explain
if we stick to a single yield_t class. Since the intention is for a consumer
to pass canonical instances rather than manipulating that class in any other
way, we can instantiate it however we want.

This gets rid of lots of ugly redundant boost::asio::handler_type<>
specializations.
2016-03-23 21:43:01 -04:00
Nat Goodspeed
85c0d26d11 Fix minor errors in doc generation. 2016-03-23 21:28:40 -04:00
Nat Goodspeed
0645d37fea Merge branch 'develop' of github.com:olk/boost-fiber into develop.
Incorporate Oliver's use of fibers::detail::spinlock, but break out
yield_base, yield_handler_base and async_result_base as before.
2016-03-23 20:27:42 -04:00
oliver Kowalke
ddab318255 wait for uncompleted asio-fiber 2016-03-16 08:51:33 +01:00
Nat Goodspeed
3e7b94c922 Fix silly compile errors in yield.hpp and detail/yield.hpp.
Still to fix: can't use ctx_->set_ready(ctx_) to wake suspended context on its
own scheduler.
2016-03-14 21:20:30 -04:00
Nat Goodspeed
5758781500 Allow caller of asio async function to permit or deny migration.
Introduce yield_base with subclasses yield_t and yield_hop_t, each with a
canonical instance yield and yield_hop. yield_base adds allow_hop_ bool to
communicate the distinction to yield_handler: yield_t sets false, yield_hop_t
sets true.

Extract common base class yield_handler_base from yield_handler<T> and
yield_handler<void>. In fact yield_handler_base is almost identical to
yield_handler<void>; yield_handler<T> adds value processing.

Instead of capturing just the error_code* from the passed yield_base instance,
capture the whole yield_base: both its error_code* and the new allow_hop_ bool.

yield_handler_base provides operator()(error_code) method. This operator()
sets a new completed_ bool so calling fiber need NOT suspend if the async
operation completes immediately. That bool must be defended with a mutex.

This operator() also avoids migrating a pinned_context, or when a caller
passes plain yield instead of yield_hop.

New wait() method suspends the calling fiber only if (! completed_).

Extract common base class async_result_base from async_result<T> and
async_result<void>. In fact async_result_base is almost identical to
async_result<void>; async_result<T> adds value processing.

Add handler_type<> specializations for new yield_base and yield_hop_t
completion token types.
2016-03-13 14:20:46 -04:00
Nat Goodspeed
f905cb4c3b Document context::suspend() and set_ready(). 2016-03-12 10:45:54 -05:00
Nat Goodspeed
d9e5bde625 Make a pass through enum class type and new context::is_context().
Do not document the specific values of enum class type values. Consuming code
should be based solely on enum names; their values are an implementation
detail.

Ensure that all enum class type values are mentioned in note for is_context()
method.
2016-03-07 21:17:56 -05:00
Nat Goodspeed
908bd3ca68 Fix up references to traits_type in stack allocation section.
Provide a link to Boost.Context's stack_traits documentation to look up
is_unbounded(), minimum_size() and maximum_size().

Fix spellings of minimum_size() and maximum_size().

When stack_traits::is_unbounded(), we shouldn't have to care about
stack_traits::maximum_size(). Consistently change:

    ! traits_type::is_unbounded() && size <= traits_type::maximum_size()

to:

    traits_type::is_unbounded() || size <= traits_type::maximum_size()
2016-03-07 21:14:37 -05:00
Nat Goodspeed
fb17dc13d4 Haskell has two L's -- see https://www.haskell.org/ 2016-03-07 20:51:58 -05:00
Oliver Kowalke
4a3442e045 apply thread_local keyword to global yield (asio) 2016-03-07 18:47:44 +01:00
Oliver Kowalke
26ca17f4e5 docu related to skynet 2016-03-04 19:15:41 +01:00
Oliver Kowalke
cd92c2b003 update docu 2016-03-04 19:10:22 +01:00
Oliver Kowalke
6c15fe0a5c foramting code 2016-03-04 18:24:25 +01:00
Oliver Kowalke
5526765c10 skynet test uses pooled_fixedsize_stack 2016-03-04 18:24:01 +01:00
Oliver Kowalke
0a3a2af486 import pooled_fixedsize_stack 2016-03-04 18:23:40 +01:00
Oliver Kowalke
0063c71ad8 remove example skynet_mt 2016-03-03 06:24:51 +01:00
oliver Kowalke
ffffd322bb imake asio example thread-safe 2016-03-01 08:56:15 +01:00
Oliver Kowalke
fc73bdfc52 merge examples echo_client+echo_server into one application 2016-02-29 19:00:42 +01:00
Oliver Kowalke
d1430e395b change asio/echo example 2016-02-28 20:24:12 +01:00
Oliver Kowalke
3572b00e59 update docu regarding to performance 2016-02-28 15:56:54 +01:00
Oliver Kowalke
d1cabf3cb3 small fix for skynet test 2016-02-28 13:03:10 +01:00
Oliver Kowalke
ccd6ebd974 update docu for stacks 2016-02-27 20:28:34 +01:00
Oliver Kowalke
58e745dcc3 documentation updated 2016-02-27 20:20:03 +01:00
Oliver Kowalke
65601ed620 addy skynet microbenchmark 2016-02-27 20:09:55 +01:00
Oliver Kowalke
1be0789aec use fast_pool_allocator for channels 2016-02-27 20:07:55 +01:00
Oliver Kowalke
a48c0eb491 fix include of headers 2016-02-27 20:07:06 +01:00
Oliver Kowalke
6f0caee2e7 docu: make isntalltion section an appendix 2016-02-18 19:23:55 +01:00
Oliver Kowalke
6fb1c627ac fix adatp_callbacks.cpp 2016-02-17 19:48:25 +01:00
Oliver Kowalke
f48cbd6f2f adatp-callbacks: C++11 does not support generalized lambda captures 2016-02-17 17:17:55 +01:00
Oliver Kowalke
b56d95b8fc fix example adapt_callbacks
C++11 does not support generalized lambda captures
2016-02-16 11:06:32 +01:00
Oliver Kowalke
43eb5bd769 fix example priority.cpp 2016-02-16 11:05:21 +01:00
Oliver Kowalke
2509553074 move returned reference in future<R>::get() 2016-02-16 09:42:06 +01:00
Oliver Kowalke
fb11931689 Update scheduling.qbk 2016-02-16 08:30:50 +01:00
Oliver Kowalke
d5faf0c8fb fix docu for context::is_context() 2016-02-16 08:29:47 +01:00
Oliver Kowalke
884bd21c4d reintroduce future<>::get() specializations in future.qbk 2016-02-16 08:15:48 +01:00
Oliver Kowalke
d8124ab12f disable section 'installing' at first 2016-02-16 08:12:33 +01:00
Oliver Kowalke
8536cdd8fe migrate a running fiber (not thread) 2016-02-16 08:10:17 +01:00
Oliver Kowalke
8e801986b3 Merge pull request #74 from nat-goodspeed/develop
Almost completed latest pass through documentation.
2016-02-16 08:05:03 +01:00
Nat Goodspeed
de4b03cb21 Tweak new wording in Rationale section.
Add a link to the section "No Spurious Wakeups" in the condition_variable
section.

Make a pass over "migrating fibers between threads," adding a link to the
whole new section on that same topic.
2016-02-15 20:31:52 -05: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
8376fda3ba Merge branch 'develop' of github.com:olk/boost-fiber into develop 2016-02-15 19:34:04 -05:00
Nat Goodspeed
ea0c16080b A few more documentation-related edits 2016-02-15 17:12:56 -05:00
Oliver Kowalke
e43cf5b1ac enum for context types 2016-02-15 19:49:22 +01:00
Oliver Kowalke
3522245899 link unit-tests against boost.thread 2016-02-13 11:25:02 +01:00
Nat Goodspeed
eb0d01bd28 Merge branch 'develop' of github.com:olk/boost-fiber into develop 2016-02-12 10:23:57 -05:00
Nat Goodspeed
87551c5419 Snapshot of ongoing pass through Fiber documentation.
Highlight predicate condition_variable::wait() method in condition_variable
front matter.

Rewrite the explanation of wait()'s Precondition.

Add a condition_variables subsection about no spurious condition_variable
wakeups. Remove "or spuriously" from wakeup conditions in wait*() methods.
First pass through "spurious wakeup" section in Rationale.

First pass through migration.qbk. Use lock_t throughout work_sharing.cpp,
instead of lock_t, lock_count and explicit std::unique_lock<std::mutex>
declarations. Unify treatment of main and dispatcher fibers.

Clarify thread-safety requirements on sched_algorithm::notify() and
suspend_until().

Clarify disable_interruption when rethrowing fiber_interrupted.

Consolidate future<T>::get(): returns T whether T is R, R& or void.

Mention nesting of disable_interruption (which matters) versus nesting of
restore_interruption (which doesn't). Mention that a disable_interruption
constructed within the scope of another disable_interruption is a no-op, both
itself and when passed to restore_interruption.

When packaged_task::operator()() stores a value or an exception, state "as if"
by promise::set_value() or set_exception(): the shared state is set ready.
Similarly for ~packaged_task() and ~promise() setting broken_promise.

Sprinkle links to the Allocator concept, std::allocator and
std::allocator_arg_t where referenced. Similarly for StackAllocator.

Add more cross-reference links where Fiber classes and methods are mentioned.
Also things like std::unique_lock and std::mutex.

Clarify error condition for value_pop() when channel is close()d.

Since fiber_specific_ptr::release() does not invoke cleanup, it should not
throw an exception raised during cleanup.
2016-02-11 11:27:26 -05:00
Nat Goodspeed
963ab8a14a Clarify timed_mutex::try_lock*() error conditions. 2016-02-10 00:36:53 -05:00
Nat Goodspeed
3910baa6c8 Fix minor typo: 'an' execution context. 2016-02-10 00:28:47 -05:00
Nat Goodspeed
60e9a688ac Flesh out explanations of sched_algorithm::suspend_until(), notify().
Document boost::fibers::scheduler::ready_queue_t and expand on the
context::ready_link(), ready_unlink() and ready_is_linked() methods.

Explain migrate() restrictions on is_main_context() and
is_dispatcher_context() context instances.
2016-02-10 00:15:26 -05:00