URING++
Loading...
Searching...
No Matches
awaitable.h
1#pragma once
2
3#include <coroutine>
4#include <liburing.h>
5
6#include "uringpp/detail/debug.h"
7
8namespace uringpp {
9
11 friend class event_loop;
12 struct io_uring_sqe *sqe_;
13 std::coroutine_handle<> h_;
14 int rc_;
15
16public:
17 sqe_awaitable(struct io_uring_sqe *sqe) : sqe_(sqe) {}
18 bool await_ready() noexcept { return false; }
19 bool await_suspend(std::coroutine_handle<> h) {
20 h_ = h;
21 ::io_uring_sqe_set_data(sqe_, this);
22 return true;
23 }
24 int await_resume() { return rc_; }
25};
26
27} // namespace uringpp
Definition: event_loop.h:35
Definition: awaitable.h:10