From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9509 invoked by alias); 15 Jul 2004 02:16:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9499 invoked by uid 48); 15 Jul 2004 02:16:38 -0000 Date: Thu, 15 Jul 2004 02:16:00 -0000 Message-ID: <20040715021638.9498.qmail@sourceware.org> From: "gianni at mariani dot ws" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040114172507.13684.evijaykumar@yahoo.com> References: <20040114172507.13684.evijaykumar@yahoo.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/13684] local static object variable constructed once but ctors and dtors called multiple times on same memory when called in multiple threads X-Bugzilla-Reason: CC X-SW-Source: 2004-07/txt/msg01808.txt.bz2 List-Id: ------- Additional Comments From gianni at mariani dot ws 2004-07-15 02:16 ------- Andrew wrote: > Basically allocation of static variables in functions are not done thread > safe, I do not think there is any way that GCC will be able to do this > efficiently, I would not use local static variables if you are > going to use threads. Actually, it can be quite efficient on some platforms. Also, since this is a one-time thing, efficiency is not that big a deal. This posting from Zack Weinberg indicates pretty much how it could be done in a way that more-or-less works as efficiently as it does without thread safety. http://gcc.gnu.org/ml/gcc/2002-08/msg00284.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13684