This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: malloc patch for 2.2.4
- To: Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- Subject: Re: malloc patch for 2.2.4
- From: Bruno Haible <haible at ilog dot fr>
- Date: Wed, 22 Aug 2001 20:34:10 +0200 (CEST)
- CC: libc-alpha at sources dot redhat dot com
- References: <200108221105.NAA64372@max.zk-i.med.uni-muenchen.de>
> Second, _if_ the compiler would actually reload from the global
> variable in this case (strictly speaking it has the right to do so
> under ANSI C), I'd consider it _unsuitable_ for threaded programs.
> There would definitely need to be a switch to turn this off.
The switch exists and is called 'volatile'. If the three variables
__malloc_hook, __realloc_hook, __free_hook are declared volatile, the
compiler must not turn the local variable reference into a global
variable reference.
Bruno