Code review request: small optimization to localtime.c

Jan Grant jan.grant at bristol.ac.uk
Tue Dec 4 01:15:37 PST 2007


On Mon, 3 Dec 2007, Alfred Perlstein wrote:

[on the double-checked locking idiom]

> Karsten, _typically_ (but not always) an "unlock" operation
> requires that writes prior to the unlock be globally visible.
> 
> This is why it works almost everywhere.

Perhaps, but if you use it you should probably mark the code with
	/* XXX not guaranteed to be correct by POSIX */

Double-checked locking is broken without an appropriate barrier. 
"Correctness over speed" should surely be our watchword :-)

Cheers,
jan

-- 
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661   http://ioctl.org/jan/
Hang on, wasn't he holding a wooden parrot? No! It was a porcelain owl.


More information about the freebsd-arch mailing list