This is a discussion on Re: Code review request: small optimization to localtime.c - FreeBSD ; 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 ...
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.
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"