io_uring_wai..._min_timeout(3)

πŸ’– io_uring_wai..._min_timeout β€” liburing Manual πŸ’–

okay bestie, gather round, because this one is a liburing page (yes, the manual, the one that ships with liburing) and it's giving "wait for completions but make it ✨fancy✨". sit down, sip ur drink, let's go πŸ“


✨ NAME ✨

io_uring_wait_cqes_min_timeout β€” wait for completions with both a batch timeout and a normal timeout. two timeouts. double the drama. πŸ’…


🌸 SYNOPSIS 🌸

#include <liburing.h>

int io_uring_wait_cqes_min_timeout(struct io_uring *ring,
                                   struct io_uring_cqe **cqe_ptr,
                                   unsigned wait_nr,
                                   struct __kernel_timespec *ts,
                                   unsigned int min_wait_usec,
                                   sigset_t *sigmask);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, io_uring_wait_cqes_min_timeout(3) waits for completions from the submission queue that belongs to the ring πŸ‘‘ β€” and it's waiting for wait_nr completion events, or until the timeout ts expires. whichever comes first, no cap.

those completion events get stored in the cqe_ptr array. and if it's non-zero, min_wait_usec denotes a timeout for the wait_nr batch. cute, right?

now, sigmask specifies the set of signals to block. if it's set, it's equivalent to atomically executing these calls β€” like, all together, as one vibe:

sigset_t origmask;

pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);
ret = io_uring_wait_cqes_min_timeout(ring, cqe, wait_nr, ts, min_wait, NULL);
pthread_sigmask(SIG_SETMASK, &origmask, NULL);

this works like io_uring_submit_and_wait_min_timeout(3) except that it doesn't submit requests. that's the whole difference, bestie. if you wanna know how the min timeout waiting actually works, go read that man page β€” it explains the whole thing. 🫢

available since 6.12 ⭐ (yes, kernel version, mark ur calendar)

πŸ”₯ RETURN VALUE πŸ”₯

on success, io_uring_wait_cqes_min_timeout(3) returns 0. icon.

on failure it returns -errno. and if the kernel doesn't support this functionality, you get -EINVAL back β€” see the note on the feature flag, ok? πŸ™ˆ

the most common failure case? not receiving a completion within the specified timeout. in that case -ETIME is returned. it's giving "u waited too long, babe" πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page, bestie, u ate it πŸ’– this one's from liburing-2.8, dated Feb 13, 2024 β€” and it's literally titled io_uring_wai..._min_timeout(3) in the header, footer, and honestly in my heart. periodt. 🌈✨

πŸ“¦ where this page comes from