mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
io_uring: fix copy_cqes logic
This commit is contained in:
parent
631c28c9e3
commit
704660c81a
@ -284,7 +284,7 @@ fn copy_cqes_ready(self: *IoUring, cqes: []linux.io_uring_cqe) u32 {
|
|||||||
const head = self.cq.head.* & self.cq.mask;
|
const head = self.cq.head.* & self.cq.mask;
|
||||||
const tail = (self.cq.head.* +% count) & self.cq.mask;
|
const tail = (self.cq.head.* +% count) & self.cq.mask;
|
||||||
|
|
||||||
if (head <= tail) {
|
if (head < tail) {
|
||||||
// head behind tail -> no wrapping
|
// head behind tail -> no wrapping
|
||||||
@memcpy(cqes[0..count], self.cq.cqes[head..tail]);
|
@memcpy(cqes[0..count], self.cq.cqes[head..tail]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user