This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: "memory" clobber in synchronization primitives


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]