Eirik Byrkjeflot Anonsen
eirik at opera.com
Wed Mar 5 00:30:58 PST 2008
pcpa at mandriva.com.br writes:
> Quoting Peter Hutterer <mailinglists at who-t.net>:
>> Paulo Cesar Pereira de Andrade wrote:
>>> I wrote a patch for the Mandriva X Server that handles keyboard
>>> events using sigio, like mouse events,
>> unless you wrote a lot more code than this, this will re-create the
>> problem that X mallocs and frees memory in the signal handler.
> I am not 100% sure about this, so feel free to correct me, but I believe
> libc malloc is reentrant
I expect most general mallocs are thread safe these days, but actually
making malloc signal safe is a whole other matter. I'm not sure which
meaning of "reentrant" you meant :)
(By the way, there are more meanings to "reentrant" than those two...)
While it is certainly possible to make malloc signal safe (though I
expect that will greatly increase the likelihood of it returning
NULL), I doubt that many mallocs are designed to be signal safe.
Depending on malloc being signal safe sounds a bit optimistic to me...
More information about the xorg