diff options
author | Niels Provos <provos@gmail.com> | 2007-11-27 01:39:10 +0000 |
---|---|---|
committer | Niels Provos <provos@gmail.com> | 2007-11-27 01:39:10 +0000 |
commit | 5f3e31596b1a231a6041b9a1302d8059293a9b02 (patch) | |
tree | f1ce1a980302c251b84a4152ca76ba0d57d6d704 | |
parent | a7a7a1904507bb7fcc22a3c045c030d2837c3510 (diff) | |
download | libevent-5f3e31596b1a231a6041b9a1302d8059293a9b02.tar.gz |
move EV_PERSIST handling out of the event backends
svn:r555
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | epoll.c | 6 | ||||
-rw-r--r-- | event.c | 9 | ||||
-rw-r--r-- | evport.c | 11 | ||||
-rw-r--r-- | kqueue.c | 2 | ||||
-rw-r--r-- | poll.c | 4 | ||||
-rw-r--r-- | select.c | 4 |
7 files changed, 9 insertions, 28 deletions
@@ -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: @@ -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) @@ -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); @@ -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 */ @@ -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); @@ -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); } } @@ -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); } } |