Commit Graph

1840 Commits

Author SHA1 Message Date
Nat Goodspeed
4a7f5b87af Merge branch 'develop' of github.com:olk/boost-fiber into develop 2015-08-26 13:17:37 -04:00
Nat Goodspeed
7af7bd2520 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-08-26 13:10:31 -04:00
Oliver Kowalke
2601e72673 let sched_algo_ be managed by unique_ptr 2015-08-26 18:59:18 +02:00
Nat Goodspeed
8cce2bb668 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-08-26 11:56:11 -04: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
0631726bf6 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-08-26 11:35:49 -04:00
Oliver Kowalke
887c96f835 interrupt + join deteched fibers in dtor fiber-manger 2015-08-26 17:29:54 +02:00
Oliver Kowalke
9a667e751e fix formating code 2015-08-26 17:27:51 +02:00
Nat Goodspeed
f97956fa33 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-08-26 10:39:46 -04:00
Oliver Kowalke
49b4b095fb wait for detached fibers in dtor of fiber_manager 2015-08-25 22:16:42 +02:00
Nat Goodspeed
0f7b6ae71c Add notes that echo_client.cpp and echo_client2.cpp are borrowed from asio.
The casual reader, on encountering these in the Fiber examples directory,
might otherwise assume they're intended to illustrate something about the
Fiber library.
2015-08-25 13:07:35 -04:00
Nat Goodspeed
8e21537c3e Recommend std::unique_lock instead of std::lock_guard for mutex.
The condition_variable examples spoke about std::lock_guard. But this doesn't
work in practice, as lock_guard has no unlock() method. Use unique_lock
instead, as test_condition.cpp does.
2015-08-25 12:56:53 -04:00
Nat Goodspeed
c52a914906 Add examples/when_stuff.cpp illustrating when_any_simple().
when_any_simple() is "simple" in the sense that we don't care about return
values or possible exceptions -- we only want to know when the shortest
subtask completes.

This source is a work in progress. We intend to add more cases.
2015-08-25 10:13:25 -04:00
Oliver Kowalke
73d38028c4 code re-formating of asio examples 2015-08-24 20:08:56 +02:00
Oliver Kowalke
91555307e5 fix typo in documentation 2015-08-24 19:52:26 +02:00
Oliver Kowalke
aa79e05d25 fix code format in examples 2015-08-24 19:52:00 +02:00
Oliver Kowalke
de8feb7ff9 documentation: add link to boost.context for WinFiber support 2015-08-24 17:40:27 +02:00
Oliver Kowalke
46ab42c1cb Merge pull request #54 from nat-goodspeed/develop
Add callbacks.qbk about interfacing Fiber with async callbacks.
2015-08-24 17:37:38 +02:00
Nat Goodspeed
8a79caef11 Merge branch 'develop' of github.com:olk/boost-fiber into develop 2015-08-24 09:35:00 -04: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
Oliver Kowalke
3860adbbb1 Merge pull request #53 from nat-goodspeed/develop
Add new example programs about adapting async and nonblocking APIs.
2015-08-23 23:48:23 +02:00
Nat Goodspeed
685ba8f16f Add examples/adapt_nonblocking.cpp.
This illustrates how Fiber can ease the problem of wrapping retries for
nonblocking I/O in an event-driven program.
2015-08-23 17:20:49 -04:00
Nat Goodspeed
68044bb349 Don't embed semantically meaningful function calls in assert(). 2015-08-23 17:15:30 -04:00
Nat Goodspeed
550aae5029 Add examples/adapt_method_calls.cpp.
This illustrates how to interface a synchronous Fiber function with an async
API whose notification consists of an abstract base class with virtual
success/error methods.
2015-08-23 11:53:33 -04:00
Nat Goodspeed
7beab5b285 Add examples/adapt_callbacks.cpp.
This illustrates a few different ways of using promise and future to interface
between an asynchronous callback and the Fiber library.
2015-08-23 11:17:10 -04:00
Oliver Kowalke
8f963d03f0 remove BOOST_FIBERS_SEGMENTS - boost.context used instead 2015-08-23 10:48:21 +02:00
Oliver Kowalke
7f5ea5bc88 Merge pull request #52 from nat-goodspeed/nospawn
Reimplement boost::fibers::asio::yield with promise/future.
2015-08-23 10:08:54 +02:00
Nat Goodspeed
f3213aae54 use_future.hpp and yield.hpp no longer need handler_invoke_hook.hpp. 2015-08-22 14:43:16 -04:00
Nat Goodspeed
0b2e7619c1 Merge branch 'develop' of http://github.com/olk/boost-fiber into nospawn
Resolved conflicts:
	examples/asio/echo_server.cpp
	examples/asio/publish_subscribe/server.cpp
2015-08-22 14:33:00 -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
2c1f66af77 modify asio examples 2015-08-20 20:56:00 +02:00
Oliver Kowalke
2c13c0c362 Merge pull request #51 from nat-goodspeed/develop
Add section about integration with another main loop.
2015-08-19 20:28:00 +02:00
Nat Goodspeed
99db8d50a8 Add section about integration with another main loop.
Asio integration may be a much larger topic, per email.
2015-08-19 06:18:08 -04:00
Oliver Kowalke
2855e5128a fix asio stuff 2015-08-18 17:46:14 +02:00
Oliver Kowalke
3067fd28f1 fix bounded_channel's lwm and hwm issue 2015-08-18 17:45:54 +02:00
Oliver Kowalke
b4196c9e0b Merge pull request #49 from nat-goodspeed/develop
Fix cross-reference link syntax.
2015-08-17 15:02:52 +02:00
Nat Goodspeed
a2b18c51de Fix cross-references to other Boost libraries, per Paul Bristow.
As Paul points out, links of the form [@boost:/libs/something/index.html] (as
recommended by
http://www.boost.org/doc/libs/release/doc/html/quickbook/syntax/phrase.html#quickbook.syntax.phrase.links)
do not work when generating PDF, or even when locally generating just one
library's HTML documentation. He suggests linking explicitly to the relevant
boost.org URL. This is much more satisfying as the link can be tested.
2015-08-17 08:26:07 -04:00
Nat Goodspeed
42cfefa25f Fix [@path] links referencing .cpp files, per Paul Bristow. 2015-08-17 08:14:13 -04:00
Oliver Kowalke
225a052bdc Merge pull request #48 from nat-goodspeed/customization
Flesh out Customization section with step-by-step directions.
2015-08-17 08:04:35 +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
95cc663e43 Correctly describe bounded_channel's behavior with lwm items.
I originally assumed that a blocked bounded_channel::push() would only unblock
once the number of items in the channel dropped _below_ lwm, and described it
that way. But in fact the push unblocks as soon as the number of items in the
channel drops as low as lwm. Update documentation accordingly.
2015-08-15 11:20:19 -04:00
Nat Goodspeed
b51d78877c Test that bounded_channel(n, n) throws an exception.
Given the documented behavior of bounded_channel(hwm, lwm), it follows that
bounded_channel(n, n) is invalid.

If the number of items in the channel == hwm, a push will block.

But if the number of items in the channel <= lwm, a push will succeed without
blocking.

Therefore, setting hwm == lwm results in a contradiction.
2015-08-15 11:12:34 -04:00
Nat Goodspeed
b56ef13693 Merge branch 'develop' of http://github.com/olk/boost-fiber into develop 2015-08-15 10:49:21 -04:00
Nat Goodspeed
3e95946350 Add tests for bounded_channel::lower_bound().
We intend to document that bounded_channel(hwm) is equivalent to
bounded_channel(hwm, (hwm-1)). That may or may not simplify the code, but it
certainly simplifies the reader's mental model of the relationship between the
two constructors.

However, that assertion requires that for bounded_channel(hwm), lower_bound()
in fact return (hwm-1). Test for that.

Also use BOOST_CHECK_EQUAL(a, b) instead of BOOST_CHECK(a == b) where
applicable, since the former is more informative when the test fails.

Sadly, tests on channel_op_status must still use BOOST_CHECK(a == b) --
apparently because channel_op_status, as an enum class, cannot be streamed to
std::ostream?
2015-08-15 10:48:58 -04:00
Oliver Kowalke
514e618924 Merge pull request #46 from nat-goodspeed/develop
Eliminate opaque fiber_properties::back_ptr typedef.
2015-08-14 22:43:35 +02: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
Oliver Kowalke
34ea3ef9bd Merge pull request #45 from nat-goodspeed/develop
Review rationale.qbk
2015-08-14 17:30:08 +02:00
Nat Goodspeed
7a7e10295d Track renamed rationale.qbk. Move it just after overview.qbk. 2015-08-14 11:22:13 -04:00
Nat Goodspeed
666ada61ec Review rationale.qbk. 2015-08-14 11:21:42 -04:00
Nat Goodspeed
e08611555b Rename rational.qbk to rationale.qbk. 2015-08-14 11:10:44 -04:00