diff --git a/ext/event/backend/uring.c b/ext/event/backend/uring.c index 15f51bec..659c09f0 100644 --- a/ext/event/backend/uring.c +++ b/ext/event/backend/uring.c @@ -421,24 +421,24 @@ unsigned select_process_completions(struct io_uring *ring) { unsigned head; struct io_uring_cqe *cqe; - io_uring_for_each_cqe(ring, head, cqe) { - ++completed; - - // If the operation was cancelled, or the operation has no user data (fiber): - if (cqe->res == -ECANCELED || cqe->user_data == 0 || cqe->user_data == LIBURING_UDATA_TIMEOUT) { - continue; - } - - VALUE fiber = (VALUE)cqe->user_data; - VALUE result = INT2NUM(cqe->res); - - // fprintf(stderr, "cqe res=%d user_data=%p\n", cqe->res, (void*)cqe->user_data); - - Event_Backend_transfer_result(fiber, result); + io_uring_for_each_cqe(ring, head, cqe) { + ++completed; + + // If the operation was cancelled, or the operation has no user data (fiber): + if (cqe->res == -ECANCELED || cqe->user_data == 0 || cqe->user_data == LIBURING_UDATA_TIMEOUT) { + continue; + } + + VALUE fiber = (VALUE)cqe->user_data; + VALUE result = INT2NUM(cqe->res); + + // fprintf(stderr, "cqe res=%d user_data=%p\n", cqe->res, (void*)cqe->user_data); + + Event_Backend_transfer_result(fiber, result); } if (completed) { - io_uring_cq_advance(ring, completed); + io_uring_cq_advance(ring, completed); } return completed; diff --git a/spec/event/selector_examples.rb b/spec/event/selector_examples.rb index df03ecf2..3680e6e6 100644 --- a/spec/event/selector_examples.rb +++ b/spec/event/selector_examples.rb @@ -199,7 +199,7 @@ def now sleep(1) result = subject.process_wait(Fiber.current, pid, 0) - pp result + expect(result).to be_success events << :process_finished end @@ -218,7 +218,7 @@ def now fiber = Fiber.new do pid = Process.spawn("sleep 1") result = subject.process_wait(Fiber.current, pid, 0) - pp result + expect(result).to be_success events << :process_finished end