Commit Graph

24 Commits

Author SHA1 Message Date
oliver Kowalke
aa3ad60d07 example asio: errors mentioned by clang 2016-05-02 08:19:36 +02:00
Nat Goodspeed
9b3559dd49 Remove 'yield_hop' and the whole allow_hop_ mechanism.
Given the necessity for fibers::asio::round_robin to share its ready queue
among all threads calling io_service::run() on the same io_service instance,
the capability to allow hop (or not) in the fibers::asio::yield mechanism is
redundant.
2016-04-06 12:17:35 -04:00
Nat Goodspeed
d3b959f05a Merge branch 'develop' of github.com:olk/boost-fiber into develop 2016-03-27 22:49:46 -04:00
Nat Goodspeed
4ebc1ed2f4 Update fibers::asio::yield doc for current implementation. 2016-03-27 22:46:38 -04:00
oliver Kowalke
e8f922a8f1 some code formating 2016-03-24 08:07:34 +01:00
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
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
Oliver Kowalke
4a3442e045 apply thread_local keyword to global yield (asio) 2016-03-07 18:47:44 +01:00
Oliver Kowalke
6567fde460 add initializer brackets to yeld in example 2016-02-02 17:07:01 +01:00
Oliver Kowalke
284bdf6f78 fix asio integration - skip promise_handler 2016-01-31 16:14:14 +01:00
Oliver Kowalke
6034c1b09b reenable Nat's promise_handler impl 2015-12-05 15:14:54 +01:00
Oliver Kowalke
b032457397 asio examples added 2015-10-10 21:50:22 +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
fefffd37eb update documentation 2015-09-01 17:17:38 +02:00
Oliver Kowalke
73d38028c4 code re-formating of asio examples 2015-08-24 20:08:56 +02:00
Nat Goodspeed
1e3e2b8887 Add callbacks.qbk about interfacing Fiber with async callbacks.
This covers both generic callbacks (adapt_callbacks.cpp,
adapt_method_calls.cpp) and custom Asio completion tokens (yield.hpp,
promise_completion_token.hpp, detail/yield.hpp, detail/promise_handler.hpp).
Mark up the relevant source files to provide code snippets for callbacks.qbk.
2015-08-24 09:28:16 -04:00
Nat Goodspeed
53d4f4b166 Reimplement boost::fibers::asio::yield with promise/future.
In essence, yield_t et al. become very like use_future_t et al. The only real
difference is the async_result return type and get() method. Factor out common
functionality into promise_completion_token and promise_handler.

Remove the boost::fibers::asio::spawn() function and its basic_yield_context
infrastructure. Fix up all existing references in example source code.
2015-08-22 14:22:20 -04:00
Oliver Kowalke
ec2d9c6021 add asio examples 2015-02-12 16:29:01 +01:00
Oliver Kowalke
ee0b84240d remove asio examples 2015-02-10 18:45:26 +01:00
Oliver Kowalke
2f19be6d67 use C++11 2014-12-27 19:07:42 +01:00
Oliver Kowalke
22850775ca variadric tempalte args 2014-07-15 20:33:14 +02:00
Oliver Kowalke
e031ba4762 move asio-stuff to example section 2014-03-24 19:14:38 +01:00