From 4b2b47d6edc8c8dd75f260fed3286f5dc4fe9374 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 4 Mar 2026 08:55:10 +0100 Subject: feat: core: add ASIO example and new IOC helper 'run_loop'. Signed-off-by: Amlal El Mahrouss --- include/ocl/asio.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include') diff --git a/include/ocl/asio.hpp b/include/ocl/asio.hpp index c1e304d..1e4abf5 100644 --- a/include/ocl/asio.hpp +++ b/include/ocl/asio.hpp @@ -12,6 +12,7 @@ #else +#include #include #include #include @@ -20,4 +21,24 @@ #endif +namespace ocl::asio +{ + using io_context = boost::asio::io_context; + using run_pred_type = void(*)(); + + template + inline void run_loop(io_context& ioc) + { + try + { + ioc.run(); + } + catch (...) + { + IOCPred(); + } + } + +} // namespace ocl + #endif -- cgit v1.2.3