blob: a4c504b0b0d891f58604759615a315ea83f018d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// SPDX-License-Identifier: BSL-1.0
// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org)
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Official repository: https://github.com/ocl-foss-org/core
#ifndef OCL_CORE_ASIO
#define OCL_CORE_ASIO
#ifdef OCL_CORE_INCLUDE_ALL_ASIO
#include <boost/asio.hpp>
#else
#include <boost/asio/strand.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/write.hpp>
#include <boost/asio/read.hpp>
#endif
namespace ocl::asio
{
using io_context_type = boost::asio::io_context;
using run_pred_type = void (*)();
template <run_pred_type IOCPred>
inline void run(io_context_type& ioc)
{
try
{
ioc.run();
}
catch (...)
{
IOCPred();
}
}
} // namespace ocl::asio
#endif
|