From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: Pretest? Date: Mon, 19 Mar 2007 09:00:10 +0100 Message-ID: <45FE430A.5070703@swipnet.se> References: <45EBC39C.1080706@swipnet.se> <45F92841.3090600@swipnet.se> <20070315.210810.236560633.mituharu@math.s.chiba-u.ac.jp> <45FA4CD2.1010406@swipnet.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1174291249 349 80.91.229.12 (19 Mar 2007 08:00:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 19 Mar 2007 08:00:49 +0000 (UTC) Cc: keramida@ceid.upatras.gr, cyd@stupidchicken.com, YAMAMOTO Mitsuharu , emacs-devel@gnu.org To: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 19 09:00:40 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HTCnH-0004WG-0t for ged-emacs-devel@m.gmane.org; Mon, 19 Mar 2007 09:00:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HTCoi-0004n9-9T for ged-emacs-devel@m.gmane.org; Mon, 19 Mar 2007 03:02:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HTCof-0004mt-3b for emacs-devel@gnu.org; Mon, 19 Mar 2007 04:02:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HTCoa-0004le-E5 for emacs-devel@gnu.org; Mon, 19 Mar 2007 04:02:03 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HTCoa-0004lY-Bv for emacs-devel@gnu.org; Mon, 19 Mar 2007 03:02:00 -0500 Original-Received: from av6-2-sn3.vrr.skanova.net ([81.228.9.180]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HTCn8-0002OV-0O for emacs-devel@gnu.org; Mon, 19 Mar 2007 04:00:30 -0400 Original-Received: by av6-2-sn3.vrr.skanova.net (Postfix, from userid 502) id 09CB637F5B; Mon, 19 Mar 2007 09:00:25 +0100 (CET) Original-Received: from smtp3-1-sn3.vrr.skanova.net (smtp3-1-sn3.vrr.skanova.net [81.228.9.101]) by av6-2-sn3.vrr.skanova.net (Postfix) with ESMTP id CBD1737F44; Mon, 19 Mar 2007 09:00:24 +0100 (CET) Original-Received: from husetbladh.homeip.net (81-235-205-78-no59.tbcn.telia.com [81.235.205.78]) by smtp3-1-sn3.vrr.skanova.net (Postfix) with ESMTP id 25A2737E50; Mon, 19 Mar 2007 09:00:22 +0100 (CET) User-Agent: Thunderbird 1.5.0.10 (X11/20070302) In-Reply-To: <45FA4CD2.1010406@swipnet.se> X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:68084 Archived-At: Jan Dj=E4rv skrev: >=20 >=20 > YAMAMOTO Mitsuharu skrev: >>>>>>> On Thu, 15 Mar 2007 12:04:33 +0100, Jan Dj=E4rv=20 >>>>>>> said: >> >>>> I suspect src/gmalloc.c, which does not provide thread-safe malloc >>>> (correct me if I'm wrong), is used while HAVE_GTK_AND_PTHREAD is >>>> defined. >> >>> If src/gmalloc.c is used, then the hooks in alloc.c are used, so >>> they should be thread safe. >> >> No, alloc_mutex only protects the variables __malloc_hook etc., but >> not for the heap itself. Consider the following scenario: >> >> 1) The main thread calls malloc. >> 2) It then calls emacs_blocked_malloc via __malloc_hook. >> 3) __malloc_hook is set to old_malloc_hook in emacs_blocked_malloc. >> 4) Now the main thread is in execution of the original malloc. >> 5) Another thread also calls malloc. >> 6) The thread also executes the original malloc because >> __malloc_hook =3D=3D old_malloc_hook. >=20 > You are correct. Can we, should we fix this, i.e. make gmalloc.c threa= d=20 > safe? >=20 A thing to do after the release might be to synchronize with the thread s= afe=20 malloc in glibc. Jan D.