On 12/07/2016 19:51, Roman Pen wrote: > + if (s->io_q.in_flight >= MAX_EVENTS) > + break; > QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) { > iocbs[len++] = &aiocb->iocb; > - if (len == MAX_QUEUED_IO) { > + if (s->io_q.in_flight + len >= MAX_EVENTS) { > break; > }
More easily written like this: QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) { if (s->io_q.in_flight + len >= MAX_EVENTS) { break; } iocbs[len++] = &aiocb->iocb; } so that the early "if" is not necessary. Also because you forgot the braces around it. :) Paolo