| ... | @@ -300,9 +300,10 @@ pub const IO_Uring = struct { | ... | @@ -300,9 +300,10 @@ pub const IO_Uring = struct { |
| 300 | /// A convenience method for `copy_cqes()` for when you don't need to batch or peek. | 300 | /// A convenience method for `copy_cqes()` for when you don't need to batch or peek. |
| 301 | pub fn copy_cqe(ring: *IO_Uring) !io_uring_cqe { | 301 | pub fn copy_cqe(ring: *IO_Uring) !io_uring_cqe { |
| 302 | var cqes: [1]io_uring_cqe = undefined; | 302 | var cqes: [1]io_uring_cqe = undefined; |
| 303 | const count = try ring.copy_cqes(&cqes, 1); | 303 | while (true) { |
| 304 | assert(count == 1); | 304 | const count = try ring.copy_cqes(&cqes, 1); |
| 305 | return cqes[0]; | 305 | if (count > 0) return cqes[0]; |
| | 306 | } |
| 306 | } | 307 | } |
| 307 | | 308 | |
| 308 | /// Matches the implementation of cq_ring_needs_flush() in liburing. | 309 | /// Matches the implementation of cq_ring_needs_flush() in liburing. |