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: tb@MIT.EDU (Thomas Bushnell, BSG)
- Date: Mon, 31 Aug 1998 18:00:15 -0400
- Cc: drepper@cygnus.com, libc-hacker@gnu.org
Date: Mon, 31 Aug 1998 15:04:36 -0400
From: Roland McGrath <roland@frob.com>
What is the general opinion on this?
It should be well-specified which operations are guaranteed to be memory
barriers and the set should be consistent across all the ports.
I believe strongly that the x86 should have a memory clobber on all
architectures.
Since (at least in GCC)
any normal function call is a global memory barrier, it may arise seldom
enough to be subtle and unclear. The pthreads synchronization primitives
in linuxthreads are all implemented as normal functions (not macros or
inlines), so the question has not yet had to be answered.
This is right; if there is a function call, there is no need to add a
memory clobber. But if there is an inlined function, or a macro, then
a memory clobber should be there.
Thomas