Hello,

I'm using libevent for signal handling extensively and noticed a
slight problem: signals are (re)set every time you enter event_base_loop()
and the problem code is:

event_init();
// install handler for SIHCHLD with signal_set/signal_add
// fork a child process
event_dispatch();

the posix standard says:
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html [^]
If a process establishes a signal-catching function for the SIGCHLD signal 
while it has a terminated
 child process for which it has not waited, it is unspecified whether a SIGCHLD 
signal is generated 
to indicate that child process.

and therefore if child process exits before you enter event_dispatch()
you may not get SIGCHLD at all.

the workaround i use is: install signal event, install the event that fires 1ms 
after
entering event loop and in callback fork the process. but it's ugly.

is there a good reason for such behaviour except simplicity?
should i submit a bug report or a patch ? :)

-- 
Anton Povarov [ [EMAIL PROTECTED] ] [ ICQ: 85431470 ]

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to