anfd->reify = 0;
- if (anfd->events != events)
- {
- method_modify (EV_A_ fd, anfd->events, events);
- anfd->events = events;
- }
+ method_modify (EV_A_ fd, anfd->events, events);
+ anfd->events = events;
}
fdchangecnt = 0;
((struct ev_watcher *)(ev))->active = \
((struct ev_watcher *)(ev))->pending = \
((struct ev_watcher *)(ev))->priority = 0; \
- ((struct ev_watcher *)(ev))->cb = (cb_); \
+ (ev)->cb = (cb_); \
} while (0)
#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0)
#define ev_is_active(ev) (0 + ((struct ev_watcher *)(ev))->active) /* ro, true when the watcher has been started */
#define ev_priority(ev) ((struct ev_watcher *)(ev))->priority /* rw */
-#define ev_cb(ev) ((struct ev_watcher *)(ev))->cb /* rw */
+#define ev_cb(ev) (ev)->cb /* rw */
#define ev_set_priority(ev,pri) ev_priority (ev) = (pri)
#define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
| (nev & EV_WRITE ? EPOLLOUT : 0);
if (epoll_ctl (epoll_fd, mode, fd, &ev))
- fd_kill (EV_A_ fd);
+ if (errno != ENOENT /* on ENOENT the fd went away, so try to do the right thing */
+ || (nev && epoll_ctl (epoll_fd, EPOLL_CTL_ADD, fd, &ev)))
+ fd_kill (EV_A_ fd);
}
static void
poll_modify (EV_P_ int fd, int oev, int nev)
{
int idx;
+
+ if (oev == nev)
+ return;
+
array_needsize (pollidxs, pollidxmax, fd + 1, pollidx_init);
idx = pollidxs [fd];
int offs = fd >> 3;
int mask = 1 << (fd & 7);
+ if (oev == nev)
+ return;
+
if (vec_max < (fd >> 5) + 1)
{
int new_max = (fd >> 5) + 1;
-/* $Id: evdns.c,v 1.11 2007-11-04 19:45:09 root Exp $ */
+/* $Id: evdns.c,v 1.12 2007-11-04 23:14:11 root Exp $ */
/* The original version of this module was written by Adam Langley; for
* a history of modifications, check out the subversion logs.
#endif
#ifdef WIN32
-#ifndef EV_EMBED
+#ifndef EV_STANDALONE
#include "misc.h"
#endif
#endif
#else
assert (("multiple event bases not supported when not compiled with EV_MULTIPLICITY", !x_cur));
- x_cur = (struct event_base *)ev_default_loop (EVMETHOD_AUTO);
+ x_cur = (struct event_base *)(long)ev_default_loop (EVMETHOD_AUTO);
#endif
return x_cur;