mirror of /home/gitosis/repositories/libev.git
- have to re-check potentially closed fds regularly for epoll. this hurts
badly :( - still more than twice as fats as libevent. - many minor fixes
This commit is contained in:
parent
c2d0231f2e
commit
f0a5d740f6
7
ev.c
7
ev.c
|
@ -308,11 +308,8 @@ fd_reify (EV_P)
|
|||
|
||||
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;
|
||||
|
|
4
ev.h
4
ev.h
|
@ -268,7 +268,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
|
|||
((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)
|
||||
|
@ -293,7 +293,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
|
|||
#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_)
|
||||
|
||||
|
|
|
@ -43,7 +43,9 @@ epoll_modify (EV_P_ int fd, int oev, int nev)
|
|||
| (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
|
||||
|
|
|
@ -42,6 +42,10 @@ 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];
|
||||
|
|
|
@ -48,6 +48,9 @@ select_modify (EV_P_ int fd, int oev, int nev)
|
|||
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;
|
||||
|
|
4
evdns.c
4
evdns.c
|
@ -1,4 +1,4 @@
|
|||
/* $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.
|
||||
|
@ -40,7 +40,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef EV_EMBED
|
||||
#ifndef EV_STANDALONE
|
||||
#include "misc.h"
|
||||
#endif
|
||||
#endif
|
||||
|
|
2
event.c
2
event.c
|
@ -91,7 +91,7 @@ void *event_init (void)
|
|||
#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;
|
||||
|
|
Loading…
Reference in New Issue