Calling free() in signal handler -> hang
bernie at develer.com
Tue Mar 27 15:14:24 PDT 2007
Pat Kane wrote:
> Yes, the only safe (POSIX) thing to do in a signal handler is to set a flag.
Well, you can also call a bunch of safe lib functions as specified
by POSIX (see the NOTES section of the signal(2) Linux manpage).
In the case of the X server handling SEGV, they can't simply return
from the signal handler until they've done some emergency cleanup
to restore the video card and the console.
Unfortunately, this is driver dependent and uses the very same code path
of a normal cleanup, which is full of dangerous calls such as free().
This is a recepit for crashing or, even better, deadlocking on some
The cleanup would be handled much more cleanly by the kernel, I guess.
Will it be solved by Keith's plan to push video setting to the kernel?
// Bernardo Innocenti - Develer R&D dept.
More information about the xorg