From owner-freebsd-hackers Thu Nov 9 15: 9:10 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.integratus.com (unknown [63.209.2.83]) by hub.freebsd.org (Postfix) with SMTP id 604AE37B479 for ; Thu, 9 Nov 2000 15:09:04 -0800 (PST) Received: (qmail 6677 invoked from network); 9 Nov 2000 23:08:55 -0000 Received: from kungfu.integratus.com (HELO integratus.com) (172.20.5.168) by tortuga1.integratus.com with SMTP; 9 Nov 2000 23:08:55 -0000 Message-ID: <3A0B2E87.3B49887B@integratus.com> Date: Thu, 09 Nov 2000 15:08:55 -0800 From: Jack Rusher Organization: http://www.integratus.com/ X-Mailer: Mozilla 4.73 [en] (X11; I; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: James FitzGibbon Cc: hackers@freebsd.org Subject: Re: Repeatable STL core with -pthread References: <20001109161045.D39548@targetnet.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG James FitzGibbon wrote: > > The program will core after about 10 seconds, every time. > It would appear that there is an issue with some low-level allocator in the > STL as shipped in 4.x. Dude. The STL implementation that ships with g++ isn't thread safe. In fact, if you read the STL portion of the C++ specification, you will notice that threads are not mentioned at all. The only guarantees made by the STL are that operations will complete within certain performance guidelines. As a safety tip, the string implementation in the g++ implementation isn't thread safe either. It uses a shared buffer scheme ("char* string->rep") to reduce memory consumption & improve performance. This is in opposition to "deep copy" style libraries, like the SGI STL, that work in threaded environments. Because of the way the C++ standard is written, commercial STL implementations, such as the Rogue Wave library that comes with the Sun C++ compiler, suffer from the same threading problems. -- Jack Rusher, Senior Engineer | mailto:jar@integratus.com Integratus, Inc. | http://www.integratus.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message