From owner-freebsd-arch@FreeBSD.ORG Tue Dec 4 09:15:37 2007 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9115216A4DE for ; Tue, 4 Dec 2007 09:15:37 +0000 (UTC) (envelope-from jan.grant@bristol.ac.uk) Received: from diri.bris.ac.uk (diri.bris.ac.uk [137.222.10.112]) by mx1.freebsd.org (Postfix) with ESMTP id 5AA4613C447 for ; Tue, 4 Dec 2007 09:15:37 +0000 (UTC) (envelope-from jan.grant@bristol.ac.uk) Received: from mail.ilrt.bris.ac.uk ([137.222.16.62]) by diri.bris.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1IzTcQ-0000rE-EJ; Tue, 04 Dec 2007 08:59:09 +0000 Received: from cse-jg.cse.bris.ac.uk ([137.222.12.37]:54951) by mail.ilrt.bris.ac.uk with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1IzTcD-000840-PS; Tue, 04 Dec 2007 08:58:53 +0000 Date: Tue, 4 Dec 2007 08:58:53 +0000 (GMT) From: Jan Grant X-X-Sender: cmjg@tribble.ilrt.bris.ac.uk To: Alfred Perlstein In-Reply-To: <20071204014614.GE76623@elvis.mu.org> Message-ID: <20071204085502.N83722@tribble.ilrt.bris.ac.uk> References: <20071128.151021.709401576.imp@bsdimp.com> <20071203235929.685d3674@Karsten.Behrmanns.Kasten> <20071204014614.GE76623@elvis.mu.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-ILRT-MailScanner: Found to be clean X-ILRT-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.538, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 1.86, BAYES_00 -2.60) X-ILRT-MailScanner-From: jan.grant@bristol.ac.uk X-Spam-Status: No X-Spam-Score: -0.8 X-Spam-Level: / Cc: Karsten Behrmann , freebsd-arch@freebsd.org Subject: Re: Code review request: small optimization to localtime.c X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2007 09:15:37 -0000 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.