Dbus calls interlock issue
Simon McVittie
simon.mcvittie at collabora.co.uk
Fri Feb 13 07:50:12 PST 2009
On Fri, 13 Feb 2009 at 17:50:32 +0530, Kaustubh Atrawalkar wrote:
> I have a server running with SIGCHILD handler. In sig_child handler i am...
Let me just stop you there...
The vast majority of functions cannot safely be called from a signal(2)
handler. <http://www.google.com/search?q=signal%20handler%20safe%20functions>
In particular, malloc and other memory allocations are not generally safe,
meaning that most of libc, and basically all code outside libc, is also unsafe.
(POSIX signals are terrifying like that.)
One of the few safe things to do is write the pid to a pipe (as in pipe(2))
and return; whenever a pid can be read from the other end of the pipe in
your main loop, do your cleanup and D-Bus interactions there.
Regards,
Simon
More information about the dbus
mailing list