delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/07/15:32:59

Message-Id: <200101072031.PAA28996@qnx.com>
Subject: Re: valloc and memalign draftu
To: djgpp-workers AT delorie DOT com
Date: Sun, 7 Jan 2001 15:31:46 -0500 (EST)
From: "Alain Magloire" <alain AT qnx DOT com>
In-Reply-To: <Pine.SUN.3.91.1010107091835.21289H-100000@is> from "Eli Zaretskii" at Jan 07, 2001 09:19:53 AM
X-Mailer: ELM [version 2.5 PL0b1]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Bonjour

> 
> On Sun, 7 Jan 2001, Alain Magloire wrote:
> 
> > 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.
> 
> malloc isn't documented in DJGPP as non-safe in this context.  In DJGPP, 

??
Then out of curiosity what context are you refering too.

> signal handlers are called in the normal user context (unlike on Unix), 

By this do you mean, on many other OS implementations, the signal handler
is run on a separate stack.  There are good reasons for doing it this way.

> so the handler and the code it runs is generally allowed to do anything 
> that normal C code is allowed to do.

I'm not sure I follow or understand what make DJGPP so particular. But
we are talking about "async-signal safe", POSIX defines a number that
are require to be "async-signal safe".  Some are not and from the one
that are not malloc() and friends spring to mind.  Using malloc() etc ..
in a signal handler is totally unportable.  Those functions usually
use static data structures or use global data structures that makes
them nonreentrant. i.e.  If you call malloc() and get interrupted
by a signal inside the malloc() call and in the sig handler you recall
malloc()/realloc()/memaling() again there is chance that the internal
structures(chain, freelist, link list, etc ...) were in unstable state.

If in DJGPP, you guys found a way, to make it possible for malloc()
calls to be reentrant .... great.

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019