Re: Singleton_pattern and Thread Safety
On Dec 11, 4:05 pm, "Chris M. Thomasson" <cris...@charter.net> wrote:
"Leigh Johnston" <le...@i42.co.uk> wrote in message
news:kY-dnahdNL25H57QnZ2dnUVZ7vOdnZ2d@giganews.com...
[...]
Hmm, I think I see why I might need the first barrier: is it
due to loads being made from the singleton object before the
pointer check causing problems for *clients* of the
function? any threading experts care to explain?
http://lwn.net/Articles/5159
http://mirror.linux.org.au/linux-mandocs/2.6.4-cset-20040312_2111/rea...
http://groups.google.com/group/comp.lang.c++.moderated/msg/e500c3b8b6...
Basically, the only architecture out there which requires
a data-dependant acquire barrier after the initial atomic load
of the shared instance pointer is a DEC Alpha...
You must know something I don't: the documentation of the Sparc
architecture definitely says that it isn't guaranteed; I've also
heard that it fails on Itaniums, and that it is uncertain on
80x86. (My own reading of the Intel documentation fails to turn
up a guarantee, but I've not seen everything.)
--
James Kanze