diff options
Diffstat (limited to 'example/asio_example/example.cpp')
| -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; } |
