diff options
author | root <root> | 2007-11-06 01:17:16 +0000 |
---|---|---|
committer | root <root> | 2007-11-06 01:17:16 +0000 |
commit | bdffebc95dd4e027a45853749b06f140d6f97ebc (patch) | |
tree | eb285ffe608c4a66d857af7c0c738f65e123b66d | |
parent | 692ca25945e1a987acf66bd845ce70a61aa7b160 (diff) |
better fork
-rw-r--r-- | ev_epoll.c | 11 | ||||
-rw-r--r-- | ev_kqueue.c | 11 |
2 files changed, 6 insertions, 16 deletions
@@ -110,15 +110,10 @@ epoll_destroy (EV_P) static void epoll_fork (EV_P) { - for (;;) - { - epoll_fd = epoll_create (256); - - if (epoll_fd >= 0) - break; + close (epoll_fd); - syserr ("(libev) epoll_create"); - } + while ((epoll_fd = epoll_create (256)) < 0) + syserr ("(libev) epoll_create"); fcntl (epoll_fd, F_SETFD, FD_CLOEXEC); diff --git a/ev_kqueue.c b/ev_kqueue.c index 07d16e4..8d5021f 100644 --- a/ev_kqueue.c +++ b/ev_kqueue.c @@ -185,15 +185,10 @@ kqueue_destroy (EV_P) static void kqueue_fork (EV_P) { - for (;;) - { - kqueue_fd = kqueue (); - - if (kqueue_fd >= 0) - break; + close (kqueue_fd); - syserr ("(libev) kqueue"); - } + while ((kqueue_fd = kqueue ()) < 0) + syserr ("(libev) kqueue"); fcntl (kqueue_fd, F_SETFD, FD_CLOEXEC); |