summaryrefslogtreecommitdiffhomepage
path: root/example/asio_example_2/example.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-09 05:22:54 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-03-09 05:22:54 +0100
commite52916cec7db2c3294abd7a9b45a1e708627b238 (patch)
tree044aae7594df39de3d2f2d81718b124456989761 /example/asio_example_2/example.cpp
parent5bac3b38e326598cc85053a0e5c61db7010ed049 (diff)
[CHORE] Update example.cpp unit.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'example/asio_example_2/example.cpp')
-rw-r--r--example/asio_example_2/example.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/example/asio_example_2/example.cpp b/example/asio_example_2/example.cpp
new file mode 100644
index 0000000..f16aa1e
--- /dev/null
+++ b/example/asio_example_2/example.cpp
@@ -0,0 +1,31 @@
+// 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://git.ocl.nekernel.org/core
+
+#include <ocl/print.hpp>
+#include <ocl/asio.hpp>
+#include <ocl/allocator_op.hpp>
+#include <future>
+#include <boost/process.hpp>
+
+constexpr long int operator ""_USD(long double n)
+{
+ return n * 1000.0;
+}
+
+namespace asio = ::boost::asio;
+namespace process = ::boost::process;
+
+/// @brief Wrap OCL in ASIO calls.
+int main()
+{
+ asio::io_context ioc;
+ process::process proc(ioc, "/usr/bin/g++", {"--version"}, process::v2::process_stdio{{ /* in to default */}, {}, nullptr});
+
+ proc.wait();
+
+ ocl::asio::run<[]() { (void)0; }>(ioc);
+
+ return EXIT_SUCCESS;
+}