Skip to content

Commit

Permalink
Exit pool loop when we've seen all returned events.
Browse files Browse the repository at this point in the history
Avoids issues seen on SunOS and Darwin where LIST_NEXT would return
garbage.  Use event_del() while here.
  • Loading branch information
Jonathan Perkin committed Jan 15, 2019
1 parent 55d812d commit f86a72c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkgtools/pbulk/files/pbulk/lib/event.c
Expand Up @@ -345,13 +345,11 @@ event_dispatch(void)
if (ret > 0) {
iter = poll_list;
for (ev = LIST_FIRST(&all_events);
iter < last_iter && ev && (next = LIST_NEXT(ev, ev_link), 1);
ret && iter < last_iter && ev && (next = LIST_NEXT(ev, ev_link), 1);
ev = next, ++iter) {
if (iter->revents) {
if (!ev->ev_persistent) {
--active_events;
LIST_REMOVE(ev, ev_link);
}
if (!ev->ev_persistent)
event_del(ev);
(*ev->ev_handler)(ev->ev_fd, ev->ev_arg);
--ret;
}
Expand Down

0 comments on commit f86a72c

Please sign in to comment.