mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
std/linux: sync io_uring library with liburing
liburing commit: 1bafb3ce5f
As stated in the liburing commit message, this fixes a regression,
reverting code that was added specutively to avoid a syscall in some
cases.
This commit is contained in:
parent
f950489ed9
commit
b83ef595a5
@ -163,9 +163,9 @@ pub const IO_Uring = struct {
|
||||
/// Returns the number of SQEs submitted.
|
||||
/// Matches the implementation of io_uring_submit_and_wait() in liburing.
|
||||
pub fn submit_and_wait(self: *IO_Uring, wait_nr: u32) !u32 {
|
||||
var submitted = self.flush_sq();
|
||||
const submitted = self.flush_sq();
|
||||
var flags: u32 = 0;
|
||||
if (self.sq_ring_needs_enter(submitted, &flags) or wait_nr > 0) {
|
||||
if (self.sq_ring_needs_enter(&flags) or wait_nr > 0) {
|
||||
if (wait_nr > 0 or (self.flags & linux.IORING_SETUP_IOPOLL) != 0) {
|
||||
flags |= linux.IORING_ENTER_GETEVENTS;
|
||||
}
|
||||
@ -236,9 +236,9 @@ pub const IO_Uring = struct {
|
||||
/// or if IORING_SQ_NEED_WAKEUP is set and the SQ thread must be explicitly awakened.
|
||||
/// For the latter case, we set the SQ thread wakeup flag.
|
||||
/// Matches the implementation of sq_ring_needs_enter() in liburing.
|
||||
pub fn sq_ring_needs_enter(self: *IO_Uring, submitted: u32, flags: *u32) bool {
|
||||
pub fn sq_ring_needs_enter(self: *IO_Uring, flags: *u32) bool {
|
||||
assert(flags.* == 0);
|
||||
if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0 and submitted > 0) return true;
|
||||
if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0) return true;
|
||||
if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) {
|
||||
flags.* |= linux.IORING_ENTER_SQ_WAKEUP;
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user