185 Commits

Author SHA1 Message Date
Yuan Yao
18e644045f Recover continuable after invoking void fail handlers, s.t. continuable after void fail handlers invoked can be wait. Solve second case of issue #46. 2022-05-19 22:01:49 +08:00
Denis Blank
ed8310e345 Year and version update 2022-01-20 08:41:32 +01:00
Denis Blank
01f9dbd1f4 Add support for stable coroutines (/await:strict and -fcoroutines)
* The definition CONTINUABLE_HAS_COROUTINE now indicates support for coroutines,
  while CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE is added if the experimental version is used.
2022-01-20 08:41:32 +01:00
Denis Blank
e2b5fc36fe Add continuable::via to change the invocation chain to the given executor 2021-10-20 07:41:01 +02:00
Denis Blank
48c6abf5f2 Ensure that the example given in #34 compiles in the CI
* Ref #34
2020-08-10 18:31:16 +02:00
Denis Blank
8187c16ede Improve the use_continuable_t asio completion tokens such that special mappings are aptable
* Also allow to ignore certain error types through use_continuable_ignoring
* Ref #32
2020-04-09 18:43:00 +02:00
Denis Blank
d80f5ef3ec Make the wait transform throw a wait_transform_canceled_exception on cancellation 2020-04-09 16:03:47 +02:00
Denis Blank
5f84de0e86 Handle the cancellation of continuables used in co_await expression correctly
* Throws a await_canceled_exception now which automatically gets
  converted to a default exception type again if it becomes unhandled in the handler.
* Ref #32
2020-04-09 15:34:11 +02:00
Denis Blank
33bfc490ef Rename cancel() to stop() and make cancel() return a cancellation result instead 2020-04-05 00:49:57 +02:00
Denis Blank
8c1a79d17b Update the copyright year 2020-04-04 23:31:20 +02:00
Denis Blank
1e39bd85dd Replace the result<...> implementation by a lighter one
* result<...> only moveable now, the conditional copy capabilities were removed
* If you require the optional copy capability use a std::variant implementation of your choice
* Closes #13
2020-04-04 22:26:09 +02:00
Denis Blank
2c76e6c367 Split the async tests into their own test case 2020-04-04 17:19:44 +02:00
Denis Blank
c69385be5f Implement the wait transforms tests 2020-04-04 01:51:02 +02:00
Denis Blank
ab9669fa2a Implement wait, wait_for and wait_until transforms properly
* wait is implemented by a atomic and default condition variable.
* wait_for and wait_until are expensive since we can't assume
  anything about the environment thus we have to allocate
  a persistent frame.
2020-04-04 01:11:27 +02:00
Denis Blank
df4d6ed971 Start to revise transforms 2020-04-04 00:04:51 +02:00
Denis Blank
957d3fa375 Align the cancel behaviour of result to the one used in the unhandled exception handler
* Introduce cancellation_result to represent a cancelled async task
* Add cancellation unit tests
* This doesn't allow cancellation of continuables, it is meant
  for treating the special state action canceled on the receiver side.
  Cancellation of a chain is still up to the user.
2020-04-03 22:34:08 +02:00
Denis Blank
c8c4325b5b Fix the unit tests by providing an ASSERT_ASYNC_CANCELLATION 2020-04-03 19:57:46 +02:00
Denis Blank
f1e9255eb9 Fix the test header includes 2020-04-03 19:47:42 +02:00
Christos Stratopoulos
1a1c7b68c6 Base implementation of an ASIO completion token integration
* Bump the asio version to 1.41
* Move headers that require an external dependency to include/continuable/support
* Ref #28
* Ref #27
2020-04-03 14:44:34 +02:00
Denis Blank
0b1b284e3a Add continuable_base::is_ready and continuable_base::unpack.
* Can be used to specialize the asynchronous control flow
  on immediate available asynchronous results mostly returned by:
    - make_ready_continuable
    - make_exceptional_continuable
* Usable to avoid longer unnecessary synchronous callback nestings.
* cti::query_arg_t was renamed into cti::unpack_arg_t.
* The continuation overload nowreturns result<Args...> rather
  than std::tuple<Args...>.
* Add is_ready optimizations to make_exceptional_continuable.
2019-12-26 10:13:20 +01:00
Denis Blank
ffb3db7089 Fix the asio example
* Attempt to fix the GCC warning in a different way
2019-09-02 01:03:28 +02:00
Denis Blank
959f059a25 Fix a build error 2019-09-02 00:45:53 +02:00
Denis Blank
91d51e6543 Attempt to fix the clang/GCC build 2019-09-02 00:37:37 +02:00
Denis Blank
5e8bbe7c72 Use TYPED_TEST_SUITE instead of deprecated GTest TYPED_TEST_CASE 2019-09-02 00:24:07 +02:00
Denis Blank
a2fdfdfceb Use a promise<> for work rather than a dedicated work_base 2019-09-02 00:01:26 +02:00
Denis Blank
389002e918 Improve the work wrapper 2019-09-01 23:47:59 +02:00
Denis Blank
67d77808dc Fix the GCC build after bc4d69735 2019-03-12 14:44:15 +01:00
Denis Blank
bc4d69735c Improve cti::split and make it workable with plain callbacks 2019-03-11 16:39:35 +01:00
Denis Blank
daa2fdd686 Implement cti::split which makes it possible to resolve multiple
asynchronous control flows from a single promise.
2019-03-08 22:06:44 +01:00
Denis Blank
6b4f6de10f Use the work erased type directly in release builds
* So this behaviour aligns to the one used in continuable_base and promise_base.
2019-03-08 18:27:57 +01:00
Denis Blank
fdd9a061c4 Make promise_base default constructible
* This makes it possible to use promise_base for optional
  promises directly rather than wrapping it as optional<promise_base<...>>.
* Invalidate the promise_base after its first usage.
* Expose an `operator bool()` to make the validility accessible.
* Remove the no longer needed private promise_no_init_arg_t tag.
2019-03-08 18:13:40 +01:00
Denis Blank
d72e1bfb86 Implement async_on for asynchronous execution on a specific executor
* Makes it possible to specify an executor in addition to
  the arguments passed to async.
* The reason why async should not support this directly is
  that it should be closely modelled to std::async.
2019-01-26 03:46:39 +01:00
Denis Blank
20cd0191fc For loops provide loop_result loop_break and loop_continue for better readability 2019-01-14 23:13:23 +01:00
Denis Blank
b86fe7a255 Additional work on async 2019-01-13 19:10:55 +01:00
Denis Blank
ac175b4e57 Start to implement the unit tests for loop and add range_loop 2019-01-13 18:19:49 +01:00
Denis Blank
20e8c7d3e3 Reflow the license text
* For some reason some spaces were removed,
  the license text and content stays the same.
2019-01-04 13:39:46 +01:00
Denis Blank
a3a9695174 Happy new year! 2019-01-04 13:35:44 +01:00
Denis Blank
c066940d8d Use new types instead of aliases for type erasures
* Makes compiler output much more readable
  This is configurateable through CONTINUABLE_WITH_IMMEDIATE_TYPES,
  and automatically enabled for debug builds but disabled
  for release builds.
* Remove the old continuable-trait.hpp header
* Make the signature of continuable not dependent anymore
  on any size of the arguments which fixes the compilation
  with forward declared types.
  Thanks Rogiel for the correspoding bug report.
  Closes #11
2019-01-04 13:12:48 +01:00
Denis Blank
7a10363dce Implement continuable_base<...>::as
* Can convert continuables to other compatible signatures
2018-12-26 05:38:10 +01:00
Denis Blank
30f0dca27f Fix a unit test introduced in 4127c02c3f6d 2018-12-25 11:15:06 +01:00
Denis Blank
f469b7058a Implement make_cancelling_continuable()
* Can be used to cancel the chain when being inside a handler
2018-12-25 09:30:23 +01:00
Denis Blank
4127c02c3f Add an overload to make_result which accepts a exception_arg_t and exception_t
* Can be used to forward the result correctly from next handlers
2018-12-25 09:05:51 +01:00
Denis Blank
57bb43138b Fix a recursive template instantiation issue on clang and gcc 2018-12-10 05:08:39 +01:00
Denis Blank
1320c8eb63 Add a unit test which tests for ready continuables explicitly 2018-12-09 17:01:56 +01:00
Denis Blank
7352cbf8a9 Make it possible to continue with a continuable from failure handlers 2018-11-30 02:10:05 +01:00
Denis Blank
70c716bb28 Make the failure handler partial applyable
* Make result C++17 destructible
* Add unit tests
2018-11-28 01:29:36 +01:00
Denis Blank
b77e926c41 Fix the unit tests 2018-11-26 04:37:48 +01:00
Denis Blank
82dd47b463 Cleanup the unit tests 2018-11-26 03:21:01 +01:00
Denis Blank
c5663bf1ad Add the unit tests for the failure handlers recovering and rethrowing 2018-11-26 03:02:49 +01:00
Denis Blank
ba9ff9fce0 Initial work on routing the arguments correctly when using result<...> 2018-11-26 00:41:15 +01:00