From fcc9da9f2f3b5c3002349e43faad065716606751 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 5 Mar 2026 01:25:58 +0100 Subject: feat: asio: refactors for example. Signed-off-by: Amlal El Mahrouss --- example/asio_example/example.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'example/asio_example/example.cpp') diff --git a/example/asio_example/example.cpp b/example/asio_example/example.cpp index ba30049..d5abe0a 100644 --- a/example/asio_example/example.cpp +++ b/example/asio_example/example.cpp @@ -19,16 +19,19 @@ int main() boost::asio::io_context ioc{1}; auto spawn_strand = boost::asio::make_strand(ioc); - boost::asio::co_spawn(spawn_strand, [&]() -> boost::asio::awaitable { - ocl::allocator int_alloc; + ocl::allocator int_alloc; + + boost::asio::co_spawn(spawn_strand, [&int_alloc]() -> boost::asio::awaitable { auto balance = int_alloc.construct_array<1>(); *balance = operator ""_USD(150); - ocl::io::println("USD: ", *balance); + ocl::io::println("Balance USD: ", *balance); co_return; }, boost::asio::detached); - ocl::asio::run<[]() { std::terminate(); }>(ioc); + auto balances = int_alloc.construct_array<5>(); + + ocl::asio::run<[]() { (void)0; }>(ioc); return EXIT_SUCCESS; } -- cgit v1.2.3