summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Provos <provos@gmail.com>2007-11-27 01:39:10 +0000
committerNiels Provos <provos@gmail.com>2007-11-27 01:39:10 +0000
commit5f3e31596b1a231a6041b9a1302d8059293a9b02 (patch)
treef1ce1a980302c251b84a4152ca76ba0d57d6d704
parenta7a7a1904507bb7fcc22a3c045c030d2837c3510 (diff)
downloadlibevent-5f3e31596b1a231a6041b9a1302d8059293a9b02.tar.gz
move EV_PERSIST handling out of the event backends
svn:r555
-rw-r--r--ChangeLog1
-rw-r--r--epoll.c6
-rw-r--r--event.c9
-rw-r--r--evport.c11
-rw-r--r--kqueue.c2
-rw-r--r--poll.c4
-rw-r--r--select.c4
7 files changed, 9 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index c0364bcb..a607749f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/epoll.c b/epoll.c
index fdeb1e2a..06ff66a3 100644
--- a/epoll.c
+++ b/epoll.c
@@ -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)
diff --git a/event.c b/event.c
index 13662210..a92d4f80 100644
--- a/event.c
+++ b/event.c
@@ -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);
diff --git a/evport.c b/evport.c
index d3ba5960..76688e0e 100644
--- a/evport.c
+++ b/evport.c
@@ -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 */
diff --git a/kqueue.c b/kqueue.c
index 1f2e3514..b241a951 100644
--- a/kqueue.c
+++ b/kqueue.c
@@ -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);
diff --git a/poll.c b/poll.c
index f3f3420b..9be42e17 100644
--- a/poll.c
+++ b/poll.c
@@ -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);
}
}
diff --git a/select.c b/select.c
index a21ee4ec..92c3ed31 100644
--- a/select.c
+++ b/select.c
@@ -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);
}
}