瀏覽代碼

kevent error handling

David Marec 10 月之前
父節點
當前提交
3c9f850544
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      kqueue/kq_timer.c

+ 3 - 0
kqueue/kq_timer.c

@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <sched.h>
 #include <err.h>
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h> 
 #include <unistd.h>
@@ -118,6 +119,8 @@ int main(int argc, char *argv[])
 		nev = kevent(kq, &change, 1, &event, 1, NULL);
 
 		if (nev < 0) {
+			if (errno != EINTR)
+				warn("kevent wait:");
 			/* interrupted */
 			break;
 		}