Mail Archives: djgpp-workers/2001/01/07/01:51:36
>
>
> On Fri, 5 Jan 2001, Mark E. wrote:
>
> > + /* Temporarily clear chunk-in-use bit so macros work correctly. */
> > + b1->size &= ~1;
>
> Isn't this a bit dangerous? Doesn't it leave the malloc chain in an
> inconsistent state, for a small window of opportunities? What if some
> signal (i.e. exception) strikes between this line and where you restore
> the bit, and the code run from the signal handler calls memalign?
I did not follow the thread but malloc and friends cannot be made
async-safe. What you're describing is undefined behaviour or a programming
error i.e. calling a none async-safe routine in a signal handler.
To put it another way if you call malloc()(or any routines that is not
specify async-safe) inside a signal handler you will have an undefined
behaviour, and at best a crash since malloc internals are corrupted.
Most of the time the program will appear to work correctly though <g>.
--
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!
- Raw text -