hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 1bae701e502fa4f5ad392a1a269782a08e7ff638
parent 81d4c67a4ac36b763f5395cd90ae54b7f78c5c52
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue, 18 May 2021 18:15:40 -0400

linux::io_uring: add must_get_sqe

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mlinux/io_uring/queue.ha | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/linux/io_uring/queue.ha b/linux/io_uring/queue.ha @@ -16,6 +16,13 @@ export fn get_sqe(ring: *io_uring) nullable *sqe = { return null; }; +// Returns the next available [[sqe]] for this [[io_uring]], or aborts the +// program if the queue is full. +export fn must_get_sqe(ring: *io_uring) *sqe = match (get_sqe(ring)) { + null => abort("I/O queue full"), + sq: *sqe => sq, +}; + fn needs_enter(ring: *io_uring, flags: *enter_flags) bool = { if (ring.flags & setup_flags::IOPOLL == setup_flags::IOPOLL) { return true;