#define HAVE_EPOLL 1
#define HAVE_REALTIME 1
-#define HAVE_SELECT 0
+#define HAVE_SELECT 1
#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
#define MAX_BLOCKTIME 60.
static int have_monotonic; /* runtime */
static ev_tstamp method_fudge; /* stupid epoll-returns-early bug */
-static void (*method_reify)(void);
+static void (*method_modify)(int fd, int oev, int nev);
static void (*method_poll)(ev_tstamp timeout);
ev_tstamp
void ev_postfork_child (void)
{
#if HAVE_EPOLL
- epoll_postfork_child ();
+ if (ev_method == EVMETHOD_EPOLL)
+ epoll_postfork_child ();
#endif
}
+static void
+fd_reify (void)
+{
+ int i;
+
+ for (i = 0; i < fdchangecnt; ++i)
+ {
+ int fd = fdchanges [i];
+ ANFD *anfd = anfds + fd;
+ struct ev_io *w;
+
+ int wev = 0;
+
+ for (w = anfd->head; w; w = w->next)
+ wev |= w->events;
+
+ if (anfd->wev != wev)
+ {
+ method_modify (fd, anfd->wev, wev);
+ anfd->wev = wev;
+ }
+ }
+
+ fdchangecnt = 0;
+}
+
static void
call_pending ()
{
do
{
/* update fd-related kernel structures */
- method_reify (); fdchangecnt = 0;
+ fd_reify ();
/* calculate blocking time */
if (flags & EVLOOP_NONBLOCK)