"memory" clobber in synchronization primitives
Thomas Bushnell, BSG
tb@MIT.EDU
Mon Aug 31 15:11:00 GMT 1998
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
More information about the Libc-hacker
mailing list