aboutsummaryrefslogtreecommitdiff
path: root/Utility/libkqueue.c
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@fischer.debian.org>2012-06-19 04:52:55 +0000
committerGravatar Joey Hess <joeyh@fischer.debian.org>2012-06-19 04:52:55 +0000
commit03b9341356c8d4eabfec5864957a4e49e7fcac67 (patch)
tree080f68b49b38e24f79eea14fcc2971559e68b374 /Utility/libkqueue.c
parenta5cceb7d4ff83b11da95cac204e99d1bfdbaecc9 (diff)
fix scheduling
Handle kevent interruptions in the haskell code, so it can yield to other threads
Diffstat (limited to 'Utility/libkqueue.c')
-rw-r--r--Utility/libkqueue.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Utility/libkqueue.c b/Utility/libkqueue.c
index b7f9595dc..643a63b97 100644
--- a/Utility/libkqueue.c
+++ b/Utility/libkqueue.c
@@ -17,6 +17,8 @@
/* 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
* not pass the same fds repeatedly.
+ *
+ * Returns the fd that changed, or -1 on error.
*/
signed int helper(const int kq, const int fdcnt, const int *fdlist, int nodelay) {
int i, nev;
@@ -32,12 +34,7 @@ signed int helper(const int kq, const int fdcnt, const int *fdlist, int nodelay)
0, 0);
}
- while ((nev = kevent(kq, chlist, fdcnt, evlist, 1, timeout))) {
- if (!(nev == -1 && errno == EINTR)) {
- break;
- }
- }
-
+ nev = kevent(kq, chlist, fdcnt, evlist, 1, timeout);
if (nev == 1)
return evlist[0].ident;
else
@@ -59,10 +56,7 @@ void addfds_kqueue(const int kq, const int fdcnt, const int *fdlist) {
helper(kq, fdcnt, fdlist, 1);
}
-/* Waits for a change event on a kqueue.
- *
- * Returns the fd that changed, or -1 on error.
- */
+/* Waits for a change event on a kqueue. */
signed int waitchange_kqueue(const int kq) {
return helper(kq, 0, NULL, 0);
}