bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is malloc signal-"tolerant"?


From: Stefan Hoffmeister
Subject: Re: Is malloc signal-"tolerant"?
Date: Sun, 23 Dec 2001 01:19:15 +0100

: On Sat, 22 Dec 2001 18:59:33 -0500 (EST), Roland McGrath wrote:

>> it is a well-documented fact that malloc is not a signal-safe function -
>> i.e. it cannot be called from the context of a signal handler.
>> 
>> But is malloc signal-"tolerant" in that its internal data structures
>> survive a longjmp() (or a siglongjmp()) out of a signal handler?
>
>These two are the same requirement.  

Not really, IMHO.

I can imagine a scheme where a library implementation provides an
internal registration scheme. An interested internal party could
register and unregister some "unwind" routine with a global, per-thread
longjmp "manager". As soon as any longjmp is executed, the unwind
routine is called and may do what it wants (e.g. get everything into a
consistent state). 

Convoluted, over the top, not fool-proof etc, but possibly workable -
but also definitely not worth talking about, either :-/

>In short, the answer is "no".

I was expecting this answer. Unfortunately.

Thanks,
Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]