[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] Forked processes and signals
Hello all,
I've a master process which defines an event base, and adds some events
to it
to handle signals (sigterm, sighup, ...)
This master process creates child processes with fork(), and these processes
also define an event base with signals (they do different things compared to
the master process).
What is the best way to deal with that ? I get this kind of messages when I
add events for signals in the child processes:
[warn] Added a signal to event base 0x9e42e50 with signals already added
to event_base 0x9e2a138. Only one can have signals at a time with the
epoll
backend. The base with the most recently added signal or the most recent
event_base_loop() call gets preference; do not rely on this behavior in
future Libevent versions.
I tried to use event_reinit() and/or event_base_free() on the master ev_base
in the child processes but this seems to break the loop in the master
process.
I found evsig_set_base() (which is not supposed to be used directly, since
its prototype is only in evrpc-internal.h), and I use it in the child
processes
after creating the ev_base. It seems to work fine, as I don't get the
warning
messages anymore, but I feel this is not the best way.
Any thoughts ?
Thanks in advance,
Christophe
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.