summaryrefslogtreecommitdiffhomepage
path: root/example/allocator_op_example/example.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-08 10:52:38 +0100
committerGitHub <noreply@github.com>2026-03-08 10:52:38 +0100
commit5bac3b38e326598cc85053a0e5c61db7010ed049 (patch)
tree26315ad1ed9ff551649154056a14980609c7c744 /example/allocator_op_example/example.cpp
parent97d846f41e2bccf7957983c03d1fe9867b789efb (diff)
parent00cea265f341a9f62f7183dc3d45dadfac1bcd97 (diff)
Merge pull request #45 from ocl-foss-org/update-allocator-op-example
[CHORE] Update example for allocator_op.
Diffstat (limited to 'example/allocator_op_example/example.cpp')
-rw-r--r--example/allocator_op_example/example.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/example/allocator_op_example/example.cpp b/example/allocator_op_example/example.cpp
index 665df0b..ca192ff 100644
--- a/example/allocator_op_example/example.cpp
+++ b/example/allocator_op_example/example.cpp
@@ -5,15 +5,28 @@
#include <ocl/print.hpp>
#include <ocl/allocator_op.hpp>
+#include <coroutine>
+#include <future>
/// \brief Allocation of ints example.
-int main()
+int task()
{
ocl::allocator<int> int_alloc;
auto foo = int_alloc.construct_array<1>();
- *foo = 67;
- ocl::io::print(*foo);
+ *foo = 109000;
+ ocl::io::println(*foo);
return EXIT_SUCCESS;
}
+
+int main()
+{
+ auto ret = std::async(std::launch::deferred, task);
+ auto ret2 = std::async(std::launch::deferred, task);
+ auto ret3 = std::async(std::launch::deferred, task);
+
+ ret.get();
+ ret2.get();
+ ret3.get();
+}