diff options
Diffstat (limited to 'seqreader.c')
-rw-r--r-- | seqreader.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/seqreader.c b/seqreader.c index 55a7370..78d7eae 100644 --- a/seqreader.c +++ b/seqreader.c @@ -134,8 +134,17 @@ int main(int argc, char *argv[]) { ready = 0; while (1) { if (!done[curio%(AIO_MODE + EXTRA_BUFFERS)]) { - err = io_getevents(aio, 1, AIO_MODE - events, &ev[events], NULL); - if (err < 0) perror("Error waiting for AIO\n"); +// printf("%i,%i - %i [%i %i %i %i]\n", curio, schedio, events, done[0], done[1], done[2], done[3]); + + if (curio < schedio) { + err = io_getevents(aio, 1, AIO_MODE + EXTRA_BUFFERS - events, &ev[events], NULL); + if (err < 0) { + printf("Error waiting for AIO (%i)\n", -err); + exit(-1); + } + } else { + err = 0; + } if ((!ready)&&(err > 1)) { printf("*** Multiple read requests (%i of %i) are finished simultaneously. It is either:\n", err, AIO_MODE); @@ -154,6 +163,7 @@ int main(int argc, char *argv[]) { events += err; for (i = events - 1; (i >= 0)&&((schedio - curio) < (AIO_MODE + EXTRA_BUFFERS)); i--) { +// printf("sched (%i): %i\n", i, schedio); struct iocb *newio = (struct iocb *)ev[i].obj; memset(newio, 0, sizeof(struct iocb)); io_prep_pread(newio, fd, buffer + (schedio % (AIO_MODE + EXTRA_BUFFERS)) * BLOCK_SIZE, BLOCK_SIZE, schedio * BLOCK_SIZE); |