Condy v1.9
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
helpers.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
11#include "condy/concepts.hpp"
12#include <utility>
13
14namespace condy {
15namespace detail {
16
17template <typename CoroFunc> struct SpawnHelper {
18 void operator()(auto &&res) noexcept {
19 co_spawn(func(std::forward<decltype(res)>(res))).detach();
20 }
21 CoroFunc func;
22};
23
24template <typename Channel> struct PushHelper {
25 void operator()(auto &&res) noexcept {
26 channel.force_push(std::forward<decltype(res)>(res));
27 }
28 Channel &channel;
29};
30
31struct FixedFd {
32 int value;
33};
34
35template <typename T> struct FixedBuffer {
36 T value;
37 int buf_index;
38};
39
40} // namespace detail
41} // namespace condy
The main namespace for the Condy library.
Definition condy.hpp:37
Task< T, Allocator > co_spawn(Runtime &runtime, Coro< T, Allocator > coro) noexcept
Spawn a coroutine as a task in the given runtime.
Definition task.hpp:101