This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: "memory" clobber in synchronization primitives
- To: roland@frob.com
- Subject: Re: "memory" clobber in synchronization primitives
- From: Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
- Date: 1 Sep 1998 09:48:51 -0000
- CC: libc-hacker@gnu.org
- References: <199808311904.PAA12326@baalperazim.frob.com>
> It is not particularly clear to me from 1003.1-1996 whether
> pthread_mutex_lock et al are expected to be explicit memory barriers
> obviating the need for `volatile'-qualified reads.
David Butenhof's `Programming with POSIX threads' (if I read it
correctly) makes it abundantly clear that mutexes _are_ explicit
memory barriers. Further, it mostly discourages the use of `volatile'
in threaded code, because by itself `volatile' doesn't guarantee any
ordering of memory accesses, at least on modern multiprocessor
architectures.
Regards,
Wolfram.
--
`Surf the sea, not double-u three...'
wmglo@dent.med.uni-muenchen.de