Condy v1.8
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 operator int() const { return value; }
34};
35
36template <typename T> struct FixedBuffer {
37 T value;
38 int buf_index;
39};
40
41} // namespace detail
42} // 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