From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20199 invoked by alias); 24 Jan 2002 21:26:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 20159 invoked by uid 61); 24 Jan 2002 21:26:00 -0000 Date: Thu, 24 Jan 2002 13:26:00 -0000 Message-ID: <20020124212600.20158.qmail@sources.redhat.com> To: andrew@andypo.net, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, ljrittle@gcc.gnu.org, rodrigc@gcc.gnu.org From: ljrittle@gcc.gnu.org Reply-To: ljrittle@gcc.gnu.org, andrew@andypo.net, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, ljrittle@gcc.gnu.org, rodrigc@gcc.gnu.org, gcc-gnats@gcc.gnu.org X-Mailer: gnatsweb 2.9.3 Subject: Re: libstdc++/5432: Implementation still not thread-safe on multiprocessor machines X-SW-Source: 2002-01/txt/msg00874.txt.bz2 List-Id: Synopsis: Implementation still not thread-safe on multiprocessor machines State-Changed-From-To: analyzed->feedback State-Changed-By: ljrittle State-Changed-When: Thu Jan 24 13:25:59 2002 State-Changed-Why: Andrew, there were two minor issues with your patch: (And it took collective thought to figure all this out so don't feel bad. ;-) In general, static _Atomic_word should always be init'd to 0 with C++. We think g++ follows the init order rules of C which are tighter than C++ but for C++ non-zero static values may not be init'd until after main() has run (the only rule says it must be done "before the related block [scope] is entered" which might be after threads were started). Secondly: < if (--_M_references == 0) // XXX MT --- > if (__exchange_and_add(&_M_references, -1) == 1) is correct (you had == 0). I.e. assuming it was correct as written (other than thread-safety) your rewrite had a memory leak. Other than that, Nathan and I have reviewed the patch; I have tested it and installed it (that report to the libstdc++ mailing list). To be closed after you confirm MP *-*-linux* system fixed as installed and then I move it to 3.0.X branch. Thanks, Loren http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5432