Scott -

Quoth Homer: *DOH*.  Very true, I only ever had one signal handler.  I
changed my signal.c to do reference counting so that I can live with
myself.  Since Wouter fixed it already, though, I'll grab the trunk from
subversion and play with that, too.

Thanks!
-Jesse

On Tue, 2007-05-29 at 09:44 +0200, Wouter Wijngaards wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> Not sure if 1.3b has my signal patch in it; but I believe I paid
> attention so that all the internal signal events are deleted properly
> (on event-base-free). Could be my mistake still, but are you sure that
> the bug still exists in libevent-trunk?
> 
> The reason I think its different, is that with my patch (which is in
> trunk for sure), multiple event bases will use multiple internal events
> for signal handling where libevent-1.1 would use only one internal event
> ever. And the bases would clean up their events on free (at least - that
> is the theory of operation :-) ).
> 
> Best regards,
>    Wouter
> 
> Scott Lamb wrote:
> > 
> > On May 28, 2007, at 8:28 AM, Jesse Keller wrote:
> > 
> >> Just implemented libevent in a new program using the cool eventxx C++
> >> wrapper.  Anyway, I decided to track down the event_base_free bug a
> >> little more.  Here's the original bug and patch.
> >>
> >> http://monkeymail.org/archives/libevent-users/2006-April/000141.html
> >>
> >> Seems that we don't need to go through all that effort of fixing the
> >> symptom, it's just that the internal event between the signal handler
> >> and the dispatcher is never deleted.
> >>
> >> Here's the patch that fixes the problem for me (versus the 1.3b release)
> >>
> >>
> >> --- signal.c    2007-03-03 23:05:07.000000000 -0500
> >> +++ signal.c.new        2007-05-28 11:10:57.000000000 -0400
> >> @@ -143,6 +143,11 @@
> >>         int evsignal;
> >>
> >>         evsignal = EVENT_SIGNAL(ev);
> >> +
> >> +       if (ev_signal_added) {
> >> +               ev_signal_added = 0;
> >> +               event_del(&ev_signal);
> >> +       }
> >>
> >>         return (sigaction(EVENT_SIGNAL(ev),(struct sigaction *)SIG_DFL,
> >> NULL));
> >>  }
> > 
> > But ev_signal is for the pipe used to wake up on receipt of *any*
> > signal. Consider this code snippet:
> > 
> >     signal_set(&ev1, SIGUSR1, signal_cb, NULL);
> >     event_add(&ev1, NULL);
> >     signal_set(&ev2, SIGUSR2, signal_cb, NULL);
> >     event_add(&ev2, NULL);
> >     event_del(&ev2);
> > 
> >     raise(SIGUSR1);
> >     event_dispatch(EVLOOP_ONCE);
> > 
> > without your change, the dispatch would return immediately. With your
> > change, it would wait until timeout.
> > 
> > --Scott Lamb <http://www.slamb.org/>
> > _______________________________________________
> > Libevent-users mailing list
> > Libevent-users@monkey.org
> > http://monkey.org/mailman/listinfo/libevent-users
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
> 
> iD8DBQFGW9nikDLqNwOhpPgRAkVuAJ93LjcTFeIuEw5jecLf/05LRl0F8QCeIVe2
> 9DRVVVs8aDY3DzjTBwLepXo=
> =Gllv
> -----END PGP SIGNATURE-----
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to