diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-12 07:00:18 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-12 07:00:18 +0100 |
| commit | a4339ea4b5c331cf835937488aa15c6332298df0 (patch) | |
| tree | 146c4f2e5d3632e39d66ab4ca9264fa1d9fb47e9 /example | |
| parent | deca9f5be38700763023d565558c0e3c4799b2e2 (diff) | |
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'example')
| -rw-r--r-- | example/asio_example/example.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/example/asio_example/example.cpp b/example/asio_example/example.cpp index 07bc62f..a03cae3 100644 --- a/example/asio_example/example.cpp +++ b/example/asio_example/example.cpp @@ -18,21 +18,23 @@ using namespace boost; int main() { - auto rope = tproc::crope("The Quick Brown Fox Jumps Over The Lazy Dog"); - auto new_elem = std::make_unique<tproc::crope>(", and Jumps again"); + auto rope = tproc::crope("The Quick Brown Fox Jumps Over The Lazy Dog"); + auto new_elem = std::make_unique<tproc::crope>(", and Jumps again"); auto new_elem_2 = std::make_unique<tproc::crope>(", and then Jumps down."); - + boost::asio::io_context ioc{1}; auto spawn_strand = boost::asio::make_strand(ioc); - - boost::asio::co_spawn(spawn_strand, [&new_elem, &new_elem_2, &rope]() -> boost::asio::awaitable<void> { - rope.concat(new_elem.get()); - new_elem->concat(new_elem_2.get()); - - co_return; - }, boost::asio::detached); + + boost::asio::co_spawn( + spawn_strand, [&new_elem, &new_elem_2, &rope]() -> boost::asio::awaitable<void> { + rope.concat(new_elem.get()); + new_elem->concat(new_elem_2.get()); + + co_return; + }, + boost::asio::detached); ocl::asio::run<[]() { (void)0; }>(ioc); - + std::cout << rope << std::endl; } |
