Skip to content

Commit

Permalink
Merge pull request #35 from manpen/master
Browse files Browse the repository at this point in the history
Fix interrupted syscall in linuxaio queue
  • Loading branch information
bingmann committed Apr 25, 2016
2 parents 052d8b3 + ab52943 commit 5b9663e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/io/linuxaio_queue.cpp
Expand Up @@ -232,10 +232,19 @@ void linuxaio_queue::wait_requests()
break;

// wait for at least one of them to finish
long num_events = syscall(SYS_io_getevents, context, 1, max_events, events, NULL);
if (num_events < 0) {
STXXL_THROW_ERRNO(io_error, "linuxaio_queue::wait_requests"
" io_getevents() nr_events=" << max_events);
long num_events;
while(1) {
num_events = syscall(SYS_io_getevents, context, 1, max_events, events, NULL);
if (num_events < 0) {
if (errno == EINTR) {
// io_getevents may return prematurely in case a signal is received
continue;
}

STXXL_THROW_ERRNO(io_error, "linuxaio_queue::wait_requests"
" io_getevents() nr_events=" << max_events);
}
break;
}

num_posted_requests++; // compensate for the one eaten prematurely above
Expand Down

0 comments on commit 5b9663e

Please sign in to comment.