On 8/20/23 12:18 PM, Matthew Wilcox wrote: > On Sun, Aug 20, 2023 at 08:11:04AM -0600, Jens Axboe wrote: >> +static int io_get_single_event(struct io_event *event) >> +{ >> + int ret; >> + >> + do { >> + /* >> + * We can get -EINTR if competing with io_uring using signal >> + * based notifications. For that case, just retry the wait. >> + */ >> + ret = io_getevents(io_ctx, 1, 1, event, NULL); >> + if (ret != -EINTR) >> + break; >> + } while (1); >> + >> + return ret; >> +} > > Is there a reason to prefer this style over: > > do { > ret = io_getevents(io_ctx, 1, 1, event, NULL); > } while (ret == -1 && errno == EINTR); > > (we need to check errno, here, right? Or is io_getevents() special > somehow?) Honestly, don't really care about the style, mostly cared about getting a bug fixed. io_getevents() returns number of events claimed, or -errno. -- Jens Axboe