retry interrupted kevent calls
Many thanks to geekosaur in #haskell for help with this.
This commit is contained in:
parent
a11825a1f1
commit
b141d9bcc8
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* The specified fds are added to the set of fds being watched for changes.
|
||||
* Fds passed to prior calls still take effect, so it's most efficient to
|
||||
|
@ -30,7 +31,11 @@ signed int helper(const int kq, const int fdcnt, const int *fdlist,
|
|||
0, 0);
|
||||
}
|
||||
|
||||
nev = kevent(kq, chlist, fdcnt, evlist, 1, timeout);
|
||||
while ((nev = kevent(kq, chlist, fdcnt, evlist, 1, timeout))) {
|
||||
if (!(nev == -1 && errno == EINTR)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nev == 1)
|
||||
return evlist[0].ident;
|
||||
|
|
Loading…
Add table
Reference in a new issue