move EV_PERSIST handling out of the event backends

svn:r555
This commit is contained in:
Niels Provos 2007-11-27 01:39:10 +00:00
parent a7a7a19045
commit 5f3e31596b
7 changed files with 9 additions and 28 deletions

View File

@ -14,6 +14,7 @@ Changes in current version:
o Add a more powerful evbuffer_readln as a replacement for evbuffer_readline. The new function handles more newline styles, and is more useful with buffers that may contain a nul characters.
o Do not mangle socket handles on 64-bit windows.
o The configure script now takes an --enable-gcc-warnigns option that turns on many optional gcc warnings. (Nick has been building with these for a while, but they might be useful to other developers.)
o move EV_PERSIST handling out of the event backends
Changes in 1.4.0:

View File

@ -230,12 +230,6 @@ epoll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
if (!(evread||evwrite))
continue;
if (evread != NULL && !(evread->ev_events & EV_PERSIST))
event_del(evread);
if (evwrite != NULL && evwrite != evread &&
!(evwrite->ev_events & EV_PERSIST))
event_del(evwrite);
if (evread != NULL)
event_active(evread, EV_READ, 1);
if (evwrite != NULL)

View File

@ -336,9 +336,6 @@ event_process_active(struct event_base *base)
int i;
short ncalls;
if (!base->event_count_active)
return;
for (i = 0; i < base->nactivequeues; ++i) {
if (TAILQ_FIRST(base->activequeues[i]) != NULL) {
activeq = base->activequeues[i];
@ -349,7 +346,10 @@ event_process_active(struct event_base *base)
assert(activeq != NULL);
for (ev = TAILQ_FIRST(activeq); ev; ev = TAILQ_FIRST(activeq)) {
event_queue_remove(base, ev, EVLIST_ACTIVE);
if (ev->ev_events & EV_PERSIST)
event_queue_remove(base, ev, EVLIST_ACTIVE);
else
event_del(ev);
/* Allows deletes to work */
ncalls = ev->ev_ncalls;
@ -490,7 +490,6 @@ event_base_loop(struct event_base *base, int flags)
res = evsel->dispatch(base, evbase, tv_p);
if (res == -1)
return (-1);

View File

@ -375,21 +375,16 @@ evport_dispatch(struct event_base *base, void *arg, struct timeval *tv)
fdi = &(epdp->ed_fds[fd]);
/*
* We now check for each of the possible events (READ or WRITE).
* If the event is not persistent, then we delete it. Then, we
* activate the event (which will cause its callback to be
* executed).
* We now check for each of the possible events (READ
* or WRITE). Then, we activate the event (which will
* cause its callback to be executed).
*/
if ((res & EV_READ) && ((ev = fdi->fdi_revt) != NULL)) {
if (!(ev->ev_events & EV_PERSIST))
event_del(ev);
event_active(ev, res, 1);
}
if ((res & EV_WRITE) && ((ev = fdi->fdi_wevt) != NULL)) {
if (!(ev->ev_events & EV_PERSIST))
event_del(ev);
event_active(ev, res, 1);
}
} /* end of all events gotten */

View File

@ -278,7 +278,7 @@ kq_dispatch(struct event_base *base, void *arg, struct timeval *tv)
continue;
if (!(ev->ev_events & EV_PERSIST))
event_del(ev);
ev->ev_flags &= ~EVLIST_X_KQINKERNEL;
event_active(ev, which,
ev->ev_events & EV_SIGNAL ? events[i].data : 1);

4
poll.c
View File

@ -199,13 +199,9 @@ poll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
continue;
if (r_ev && (res & r_ev->ev_events)) {
if (!(r_ev->ev_events & EV_PERSIST))
event_del(r_ev);
event_active(r_ev, res & r_ev->ev_events, 1);
}
if (w_ev && w_ev != r_ev && (res & w_ev->ev_events)) {
if (!(w_ev->ev_events & EV_PERSIST))
event_del(w_ev);
event_active(w_ev, res & w_ev->ev_events, 1);
}
}

View File

@ -196,13 +196,9 @@ select_dispatch(struct event_base *base, void *arg, struct timeval *tv)
res |= EV_WRITE;
}
if (r_ev && (res & r_ev->ev_events)) {
if (!(r_ev->ev_events & EV_PERSIST))
event_del(r_ev);
event_active(r_ev, res & r_ev->ev_events, 1);
}
if (w_ev && w_ev != r_ev && (res & w_ev->ev_events)) {
if (!(w_ev->ev_events & EV_PERSIST))
event_del(w_ev);
event_active(w_ev, res & w_ev->ev_events, 1);
}
}