From dev-return-8626-apmail-stdcxx-dev-archive=stdcxx.apache.org@stdcxx.apache.org Wed Sep 5 20:04:12 2012 Return-Path: X-Original-To: apmail-stdcxx-dev-archive@www.apache.org Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5C6F3D7D4 for ; Wed, 5 Sep 2012 20:04:12 +0000 (UTC) Received: (qmail 82387 invoked by uid 500); 5 Sep 2012 20:04:12 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 82320 invoked by uid 500); 5 Sep 2012 20:04:12 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 82312 invoked by uid 99); 5 Sep 2012 20:04:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 20:04:12 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 209.85.160.54 as permitted sender) Received: from [209.85.160.54] (HELO mail-pb0-f54.google.com) (209.85.160.54) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 20:04:04 +0000 Received: by pbbrp2 with SMTP id rp2so1423402pbb.41 for ; Wed, 05 Sep 2012 13:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=VUE/askMKX9/E3EYFj6fhmVSaFdkCBW7MCtkgOzBSyM=; b=c/mNhU0s/hbcXE0EjZOJ/Nik8Cgv3pqDuW65G4pcxaFwgLfgR7PNfuL7jV8yJEpidp R4xfRGoftvUtm0T9mF3NFI7UwVxY7Qhnf7aAHluMu2HRCbRAJNQj2MK+FWn+ir3mL5ft hztn6pRDfaFSFbveVa2BqTkSpnFkG+/MWGiOufmD8MojBJSFlz6lk09GNSU464YwffiJ GunOgY7ARgdzR0VYSQv6orTYy7A3BPsQgL12Oj02aZVJu/QBhYlm6HEAZRlY50+93tm4 pJ3+J67JPRKE3/5OSHbWWW1zJnX5SuEOmIgviyKYfMC6RbvG95xF/pN8XPm+k0SuJTPl FgoA== Received: by 10.66.76.231 with SMTP id n7mr51112833paw.68.1346875424107; Wed, 05 Sep 2012 13:03:44 -0700 (PDT) Received: from localhost.localdomain (72-163-0-129.cisco.com. [72.163.0.129]) by mx.google.com with ESMTPS id st6sm48947pbc.58.2012.09.05.13.03.43 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2012 13:03:43 -0700 (PDT) Message-ID: <5047B01E.2060506@gmail.com> Date: Wed, 05 Sep 2012 14:03:42 -0600 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: dev@stdcxx.apache.org CC: Liviu Nicoara Subject: Re: STDCXX-1056 [was: Re: STDCXX forks] References: <40394653-8FCC-4D04-A108-2C650AF8F95B@hates.ms> <5045E764.9090607@hates.ms> <595887D2-6E42-4BC4-AF69-085AE4BA8A7D@hates.ms> <5046BDC1.3020400@gmail.com> <50476748.9040301@gmail.com> <50479CA6.8010306@hates.ms> <5047A561.5050606@gmail.com> <5047A926.7070308@hates.ms> In-Reply-To: <5047A926.7070308@hates.ms> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 09/05/2012 01:33 PM, Liviu Nicoara wrote: > On 09/05/12 15:17, Martin Sebor wrote: >> On 09/05/2012 12:40 PM, Liviu Nicoara wrote: >>> On 09/05/12 14:09, Stefan Teleman wrote: >>>> On Wed, Sep 5, 2012 at 10:52 AM, Martin Sebor wrote: >>>> [...] >>>> OK so I did a little bit of testing, after looking at the *right* >>>> __rw_guard class. :-) >>>> >>>> I changed the std::numpunct class thusly: >>>> [...] >>> >>> I am afraid this would be unsafe, too (if I said otherwise earlier I was >>> wrong). [...] Thoughts? >> >> You're right, there's still a problem. We didn't get the double >> checked locking quite right. > > I wish for simplicity: eliminate the lazy initialization, and fully > initialize the facet in the constructor. Then we'd need no locking on > copying its data (std::string takes care of its own copying). I'm not sure how easily we can do that. Almost all of locale is initialized lazily. Some of the layers might depend on the facets being initialized lazily as well. This was a deliberate design choice. One of the constraints was to avoid dynamic initialization or allocation at startup. Another was to be able to use iostreams (to a limited extent) in low memory conditions to write an error message to stderr. It's been a long time and the details are more than a little fuzzy. I'll need to spend some time going through the code and refreshing my memory. Martin > > Liviu >