Commit Graph

1840 Commits

Author SHA1 Message Date
Oliver Kowalke
8681668213 rename example autoecho 2016-04-27 19:14:48 +02:00
oliver Kowalke
e8f3641ae6 remove shared-ready-queue from asio/round_robin 2016-04-26 14:35:30 +02:00
oliver Kowalke
52da1e907e pass dispatcher-context as arg to resume()
- use standard way how a context is suspended and pushed to
  ready-queue for dispatcher-fiber
2016-04-26 09:01:59 +02:00
Oliver Kowalke
e29082cea1 remove example asio/echo, make autoecho single threaded 2016-04-25 19:08:07 +02:00
oliver Kowalke
59692a6016 destroy callable/args on stack before set_termianted() is called
- the callable and its arguments before set_teminated() is called
- otherwise a copy of the callable remains on fiber's stack and
  will never destructed
2016-04-25 15:29:37 +02:00
oliver Kowalke
768ca27f1a example work_stealing: use std::deque<> as ready-queue 2016-04-25 10:30:33 +02:00
oliver Kowalke
5218f46350 remove unecessary argument in scheduler::suspend() 2016-04-25 10:29:44 +02:00
Oliver Kowalke
16f4324422 example autoecho: start all fibers in main thread first 2016-04-24 18:36:28 +02:00
Oliver Kowalke
19ad46c9a2 make example echo single threaded 2016-04-24 18:36:14 +02:00
Oliver Kowalke
01db63c816 at scheduler destruction join dispatcher fiber 2016-04-21 17:46:09 +02:00
oliver Kowalke
2fd3383dc6 start dispatcher-context in dtor of scheduler 2016-04-20 09:58:34 +02:00
Oliver Kowalke
57267ec957 remove support for fiber interruption 2016-04-19 18:16:31 +02:00
oliver Kowalke
5027d3526f impl. remote-ready-queue with std::vector<> 2016-04-18 12:52:48 +02:00
Oliver Kowalke
f3f5634846 call scheduling_algorithm::notify() scheduer terminats 2016-04-17 19:46:10 +02:00
Oliver Kowalke
8d80a4503c pass to correct scheduler 2016-04-15 22:54:45 +02:00
oliver Kowalke
f7d151ac86 do not interrupt() fibers at scheduler destruction
- the user is responsible that all worker fibers terminate
- dispatcher fiber must run till all worker fiber are terminated and
  the the scheduler is shut down
- flag shutdown is set in ~scheduler before resuming the ready fibers
- the ready fibers must contain at least the dispatcher fiber
2016-04-14 09:14:50 +02:00
oliver Kowalke
0a911f4ab5 some modifications for autoecho example 2016-04-14 09:14:20 +02:00
oliver Kowalke
cd24224008 change asio examples regarding to run_svc() 2016-04-12 08:39:25 +02:00
oliver Kowalke
76127cc268 asio example: scheduler must not move lambda
- the lambda posted inside iasio::rond_robin will be shared by different
  threads running io_service::run()
- the lambda must remain/executed by the thread
- re-introduction of run_svc() method
2016-04-12 08:31:49 +02:00
oliver Kowalke
171b2be879 assert in autoecho aexample
- assert if context, that has to be migrated, is equal to active context
  because that should never be possible
2016-04-11 08:21:34 +02:00
oliver Kowalke
5e3999cc5d access correct context in killing worker-fibers 2016-04-08 14:17:59 +02:00
oliver Kowalke
45af3585db migrate context: scheduler must be different 2016-04-08 14:02:32 +02:00
Oliver Kowalke
918f450027 Merge pull request #80 from nat-goodspeed/hopless
Remove 'yield_hop' and the whole allow_hop_ mechanism.
2016-04-06 19:03:13 +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
f13c24bd66 Launch client fibers on alternate thread. 2016-04-06 12:17:34 -04:00
Oliver Kowalke
f724e43105 Merge pull request #79 from nat-goodspeed/develop
Add examples/asio/autoecho.cpp to drive echo client/server automatically.
2016-04-06 08:04:25 +02:00
Nat Goodspeed
d39b9e7c80 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2016-04-05 21:19:07 -04:00
Nat Goodspeed
e2d4738c2a Merge branch 'develop' of github.com:nat-goodspeed/boost-fiber into develop 2016-04-05 21:18:33 -04:00
Nat Goodspeed
3b9c8f0b46 Add autoecho.cpp to drive echo client/server automatically. 2016-04-05 21:17:35 -04:00
Oliver Kowalke
c7e3880455 Merge pull request #77 from nat-goodspeed/develop
Defend yield_handler_base::operator() against immediate callback.
2016-04-02 19:17:32 +02:00
Nat Goodspeed
abfc4cab2a Defend yield_handler_base::operator() against immediate callback.
If the async operation invoked by the asio async function immediately calls
yield_handler_base::operator() even before control reaches
async_result_base::get(), which would suspend the calling fiber, the context*
bound by yield_handler_base's constructor is still the active() context. This
may not be passed to context::migrate(). It probably shouldn't be passed to
context::set_ready(), either.
2016-04-02 12:16:17 -04:00
Oliver Kowalke
ff3da9ec0f fix typo in stack.qbk 2016-03-28 20:29:27 +02:00
Oliver Kowalke
6b490eb190 update stack.qbk 2016-03-28 20:23:08 +02:00
Oliver Kowalke
f3cb64fb91 update html 2016-03-28 18:15:14 +02:00
Oliver Kowalke
50acc33979 Merge pull request #76 from nat-goodspeed/develop
Update fibers::asio::yield doc for current implementation.
2016-03-28 17:56:58 +02: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
oliver Kowalke
fb21bee1cb fixes form asio integration 2016-03-24 07:53:38 +01:00
Oliver Kowalke
6ba396d2ed Merge pull request #75 from nat-goodspeed/develop
Sync up with recent doc and Asio integration changes
2016-03-24 07:51:18 +01:00
Nat Goodspeed
46c696f5f6 Eliminate obsolete promise_completion_token.hpp header.
This was used in an earlier implementation of use_future (no longer present)
and fibers::asio::yield (completely reimplemented).
2016-03-23 21:51:34 -04: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
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
96cc347d1d Update README.md 2016-03-16 13:08:01 +01: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