|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Opt-in experimental coroutine-friendly bridge over ThreadPool.
More...
Go to the source code of this file.
Macros | |
| #define | ALEPH_ENABLE_EXPERIMENTAL_ASYNC 0 |
| #define | ALEPH_DETAIL_HAS_COROUTINE_HEADER 0 |
| #define | ALEPH_HAS_EXPERIMENTAL_ASYNC 0 |
Opt-in experimental coroutine-friendly bridge over ThreadPool.
This header intentionally keeps a very small scope. It does not attempt to redesign Aleph-w around coroutines or provide a full sender/receiver framework. Instead it offers:
Aleph::experimental::scheduled_operation: a move-only awaitable result handle for work scheduled on a ThreadPoolAleph::experimental::schedule(): submit a callable to a pool and obtain a scheduled_operationThe bridge is disabled by default. To enable it, build or compile with ALEPH_ENABLE_EXPERIMENTAL_ASYNC=1 and a C++20 compiler that provides <coroutine>. When these conditions are not met, the header still defines ALEPH_HAS_EXPERIMENTAL_ASYNC as 0, but no experimental async API is declared.
Portability assessment for Aleph-w's current targets:
-std=c++20 provides the coroutine support needed here-std=c++20 likewise supports this limited bridgeDesign constraints:
scheduled_operation<T> has single-consumer semantics, like std::future<T>std::reference_wrapper<T> insteadExample:
See docs/experimental_async_bridge.md and Examples/experimental_async_example.cc.
Definition in file experimental_async.H.
| #define ALEPH_DETAIL_HAS_COROUTINE_HEADER 0 |
Definition at line 109 of file experimental_async.H.
| #define ALEPH_ENABLE_EXPERIMENTAL_ASYNC 0 |
Definition at line 94 of file experimental_async.H.
| #define ALEPH_HAS_EXPERIMENTAL_ASYNC 0 |
Definition at line 119 of file experimental_async.H.