Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2007 08:58:53 +0000 (GMT)
From:      Jan Grant <jan.grant@bristol.ac.uk>
To:        Alfred Perlstein <alfred@freebsd.org>
Cc:        Karsten Behrmann <BearPerson@gmx.net>, freebsd-arch@freebsd.org
Subject:   Re: Code review request: small optimization to localtime.c
Message-ID:  <20071204085502.N83722@tribble.ilrt.bris.ac.uk>
In-Reply-To: <20071204014614.GE76623@elvis.mu.org>
References:  <20071128.151021.709401576.imp@bsdimp.com> <20071203235929.685d3674@Karsten.Behrmanns.Kasten> <20071204014614.GE76623@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071204085502.N83722>