Thank you.  I applied this to trunk.

Niels.

On Nov 10, 2007 9:14 PM, Christopher Layne <[EMAIL PROTECTED]> wrote:
> On Sat, Nov 10, 2007 at 06:49:58PM -0800, Christopher Layne wrote:
> > On Sat, Nov 10, 2007 at 06:44:12PM -0800, Christopher Layne wrote:
> > > 11. here's the funny part: evsignal_process() increments 
> > > event_count_active - but since our
>
> Here's a better patch:
>
> This removes docount entirely. docount is used to determine if the event being
> added or removed from the queue should influence base->event_count. The
> internal signal event should not be counted as an event to wait for
> - such that when one deletes all their events the event loop will
> not count the internal signal event as something to wait around for
> (nothing changes here). However, based on the previous discussion, it
> still needs to be processed as a normal active event, hence we change
> base->event_count_active regardless of if it's internal or not.
>
> -cl
>
> Index: event.c
> ===================================================================
> --- event.c     (revision 507)
> +++ event.c     (working copy)
> @@ -829,23 +829,17 @@
>  void
>  event_queue_remove(struct event_base *base, struct event *ev, int queue)
>  {
> -       int docount = 1;
> -
>         if (!(ev->ev_flags & queue))
>                 event_errx(1, "%s: %p(fd %d) not on queue %x", __func__,
>                            ev, ev->ev_fd, queue);
>
> -       if (ev->ev_flags & EVLIST_INTERNAL)
> -               docount = 0;
> -
> -       if (docount)
> +       if (~ev->ev_flags & EVLIST_INTERNAL)
>                 base->event_count--;
>
>         ev->ev_flags &= ~queue;
>         switch (queue) {
>         case EVLIST_ACTIVE:
> -               if (docount)
> -                       base->event_count_active--;
> +               base->event_count_active--;
>                 TAILQ_REMOVE(base->activequeues[ev->ev_pri],
>                     ev, ev_active_next);
>                 break;
> @@ -866,8 +860,6 @@
>  void
>  event_queue_insert(struct event_base *base, struct event *ev, int queue)
>  {
> -       int docount = 1;
> -
>         if (ev->ev_flags & queue) {
>                 /* Double insertion is possible for active events */
>                 if (queue & EVLIST_ACTIVE)
> @@ -877,17 +869,13 @@
>                            ev, ev->ev_fd, queue);
>         }
>
> -       if (ev->ev_flags & EVLIST_INTERNAL)
> -               docount = 0;
> -
> -       if (docount)
> +       if (~ev->ev_flags & EVLIST_INTERNAL)
>                 base->event_count++;
>
>         ev->ev_flags |= queue;
>         switch (queue) {
>         case EVLIST_ACTIVE:
> -               if (docount)
> -                       base->event_count_active++;
> +               base->event_count_active++;
>                 TAILQ_INSERT_TAIL(base->activequeues[ev->ev_pri],
>                     ev,ev_active_next);
>                 break;
>
> _______________________________________________
>
> Libevent-users mailing list
> Libevent-users@monkey.org
> http://monkeymail.org/mailman/listinfo/libevent-users
>
>
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to