From f776d56f36abeed4a6091c2ec9b96363213ce2b2 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 4 Nov 2007 18:29:44 +0000 Subject: [PATCH] *** empty log message *** --- ev.c | 32 +++++++++++++++++++++++++++++--- ev_epoll.c | 4 +--- ev_kqueue.c | 2 +- ev_poll.c | 2 +- evdns.c | 4 ++-- event.c | 7 ++++--- 6 files changed, 38 insertions(+), 13 deletions(-) diff --git a/ev.c b/ev.c index 97a99d2..7af2358 100644 --- a/ev.c +++ b/ev.c @@ -30,6 +30,28 @@ */ #ifndef EV_STANDALONE # include "config.h" + +# if HAVE_CLOCK_GETTIME +# define EV_USE_MONOTONIC 1 +# define EV_USE_REALTIME 1 +# endif + +# if HAVE_SELECT && HAVE_SYS_SELECT_H +# define EV_USE_SELECT 1 +# endif + +# if HAVE_POLL && HAVE_POLL_H +# define EV_USE_POLL 1 +# endif + +# if HAVE_EPOLL && HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H +# define EV_USE_EPOLL 1 +# endif + +# if HAVE_KQUEUE && HAVE_WORKING_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H +# define EV_USE_KQUEUE 1 +# endif + #endif #include @@ -351,7 +373,7 @@ fd_rearm_all (EV_P) if (anfds [fd].events) { anfds [fd].events = 0; - fd_change (fd); + fd_change (EV_A_ fd); } } @@ -643,7 +665,7 @@ ev_loop_new (int methods) loop_init (EV_A_ methods); - if (ev_methods (EV_A)) + if (ev_method (EV_A)) return loop; return 0; @@ -730,8 +752,12 @@ ev_default_destroy (void) } void -ev_default_fork (EV_P) +ev_default_fork (void) { +#if EV_MULTIPLICITY + struct ev_loop *loop = default_loop; +#endif + loop_fork (EV_A); ev_io_stop (EV_A_ &sigev); diff --git a/ev_epoll.c b/ev_epoll.c index ee7ceea..8bc8658 100644 --- a/ev_epoll.c +++ b/ev_epoll.c @@ -102,11 +102,9 @@ epoll_destroy (EV_P) static void epoll_fork (EV_P) { - int fd; - epoll_fd = epoll_create (256); fcntl (epoll_fd, F_SETFD, FD_CLOEXEC); - fd_rearm_all (); + fd_rearm_all (EV_A); } diff --git a/ev_kqueue.c b/ev_kqueue.c index 2de8874..24c3015 100644 --- a/ev_kqueue.c +++ b/ev_kqueue.c @@ -184,6 +184,6 @@ kqueue_fork (EV_P) fcntl (kqueue_fd, F_SETFD, FD_CLOEXEC); /* re-register interest in fds */ - fd_rearm_all (); + fd_rearm_all (EV_A); } diff --git a/ev_poll.c b/ev_poll.c index 7a17d4f..b858b45 100644 --- a/ev_poll.c +++ b/ev_poll.c @@ -102,7 +102,7 @@ poll_init (EV_P_ int flags) method_poll = poll_poll; pollidxs = 0; pollidxmax = 0; - polls = 0; pollsmax = 0; pollscnt = 0; + polls = 0; pollmax = 0; pollcnt = 0; return EVMETHOD_POLL; } diff --git a/evdns.c b/evdns.c index 9377712..f8ef2a1 100644 --- a/evdns.c +++ b/evdns.c @@ -1,4 +1,4 @@ -/* $Id: evdns.c,v 1.9 2007-11-04 18:15:16 root Exp $ */ +/* $Id: evdns.c,v 1.10 2007-11-04 18:29:44 root Exp $ */ /* The original version of this module was written by Adam Langley; for * a history of modifications, check out the subversion logs. @@ -40,7 +40,7 @@ #endif #ifdef WIN32 -#ifndef EV_STANDALONE +#ifndef EV_EMBED #include "misc.h" #endif #endif diff --git a/event.c b/event.c index 04bd373..030df49 100644 --- a/event.c +++ b/event.c @@ -87,7 +87,7 @@ void *event_init (void) if (x_cur) x_cur = (struct event_base *)ev_loop_new (EVMETHOD_AUTO); else - x_cur = ev_default_loop (EVMETHOD_AUTO); + x_cur = (struct event_base *)ev_default_loop (EVMETHOD_AUTO); #else assert (("multiple event bases not supported when not compiled with EV_MULTIPLICITY", !x_cur)); @@ -102,7 +102,8 @@ void event_base_free (struct event_base *base) dLOOPbase; #if EV_MULTIPLICITY - ev_loop_delete (loop); + if (ev_default_loop (EVMETHOD_AUTO) != loop) + ev_loop_destroy (loop); #endif } @@ -354,7 +355,7 @@ int event_base_once (struct event_base *base, int fd, short events, void (*cb)(i int event_base_priority_init (struct event_base *base, int npri) { - dLOOPbase; + /*dLOOPbase;*/ return 0; } -- 2.43.0