Class coro::kqueue_owner¶
Class List > coro > kqueue_owner
RAII wrapping for kqueue file descriptor.
#include <unix.h>
Public Functions¶
Type | Name |
---|---|
void | change (kevent64_s & req) noexcept bind the event to kqueue |
ptrdiff_t | events (const timespec & wait_time, gsl::span< kevent64_s > list) noexcept fetch all events for the given kqeueue descriptor |
kqueue_owner () noexcept create a fd with kqueue . Throw if the function fails. |
|
kqueue_owner (const kqueue_owner &) = delete |
|
kqueue_owner (kqueue_owner &&) = delete |
|
kqueue_owner & | operator= (const kqueue_owner &) = delete |
kqueue_owner & | operator= (kqueue_owner &&) = delete |
auto | submit (kevent64_s & req) noexcept return temporary awaitable object for given event |
~kqueue_owner () noexcept close the current kqueue file descriptor |
Public Functions Documentation¶
function change¶
void coro::kqueue_owner::change (
kevent64_s & req
) noexcept
Parameters:
req
See also: kevent64
Exception:
system_error
The function is namedchange
because the given argument is used for 'change list' fokqueue64
function events¶
ptrdiff_t coro::kqueue_owner::events (
const timespec & wait_time,
gsl::span< kevent64_s > list
) noexcept
Parameters:
wait_time
list
Returns:
ptrdiff_t
See also: kevent64
Exception:
system_error
The function is namedevents
because the given argument is used for 'event list' fokqueue64
Timeout is not an error for this function
function kqueue_owner [1/3]¶
coro::kqueue_owner::kqueue_owner () noexcept
See also: kqeueue
Exception:
system_error
function kqueue_owner [2/3]¶
coro::kqueue_owner::kqueue_owner (
const kqueue_owner &
) = delete
function kqueue_owner [3/3]¶
coro::kqueue_owner::kqueue_owner (
kqueue_owner &&
) = delete
function operator=¶
kqueue_owner & coro::kqueue_owner::operator= (
const kqueue_owner &
) = delete
function operator=¶
kqueue_owner & coro::kqueue_owner::operator= (
kqueue_owner &&
) = delete
function submit¶
inline auto coro::kqueue_owner::submit (
kevent64_s & req
) noexcept
Parameters:
req
input forchange
operation
See also: change
There is no guarantee of reusage of returned awaiter object When it is awaited, and req.udata
is null(0), the value is set to coroutine_handle<void>
auto read_async(kqueue_owner& kq, uint64_t fd) -> frame_t {
kevent64_s req{.ident = fd,
.filter = EVFILT_READ,
.flags = EV_ADD | EV_ENABLE | EV_ONESHOT};
co_await kq.submit(req);
// ...
co_await kq.submit(req);
// ...
}
function ~kqueue_owner¶
coro::kqueue_owner::~kqueue_owner () noexcept
The documentation for this class was generated from the following file interface/coroutine/unix.h