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: Fri, 16 Mar 2007 08:52:50 +0100 Message-ID: <45FA4CD2.1010406@swipnet.se> References: <45EBC39C.1080706@swipnet.se> <45F92841.3090600@swipnet.se> <20070315.210810.236560633.mituharu@math.s.chiba-u.ac.jp> 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 1174031633 6707 80.91.229.12 (16 Mar 2007 07:53:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 16 Mar 2007 07:53:53 +0000 (UTC) Cc: keramida@ceid.upatras.gr, cyd@stupidchicken.com, emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 16 08:53:47 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 1HS7Fx-00025b-OG for ged-emacs-devel@m.gmane.org; Fri, 16 Mar 2007 08:53:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HS7H2-0007m3-SZ for ged-emacs-devel@m.gmane.org; Fri, 16 Mar 2007 02:54:52 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HS7H0-0007lp-E4 for emacs-devel@gnu.org; Fri, 16 Mar 2007 03:54:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HS7Gz-0007lN-2J for emacs-devel@gnu.org; Fri, 16 Mar 2007 03:54:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HS7Gy-0007lK-Rw for emacs-devel@gnu.org; Fri, 16 Mar 2007 02:54:48 -0500 Original-Received: from av9-2-sn2.hy.skanova.net ([81.228.8.180]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HS7Fs-0005VJ-Q2 for emacs-devel@gnu.org; Fri, 16 Mar 2007 03:53:41 -0400 Original-Received: by av9-2-sn2.hy.skanova.net (Postfix, from userid 502) id 6814937F66; Fri, 16 Mar 2007 08:53:39 +0100 (CET) Original-Received: from smtp4-1-sn2.hy.skanova.net (smtp4-1-sn2.hy.skanova.net [81.228.8.92]) by av9-2-sn2.hy.skanova.net (Postfix) with ESMTP id 56D6037F2E; Fri, 16 Mar 2007 08:53:39 +0100 (CET) Original-Received: from husetbladh.homeip.net (81-235-205-78-no59.tbcn.telia.com [81.235.205.78]) by smtp4-1-sn2.hy.skanova.net (Postfix) with ESMTP id 2072E37E7C; Fri, 16 Mar 2007 08:53:37 +0100 (CET) User-Agent: Thunderbird 1.5.0.10 (X11/20070302) In-Reply-To: <20070315.210810.236560633.mituharu@math.s.chiba-u.ac.jp> 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:67995 Archived-At: YAMAMOTO Mitsuharu skrev: >>>>>> On Thu, 15 Mar 2007 12:04:33 +0100, Jan Dj=E4rv said: >=20 >>> 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. >=20 >> If src/gmalloc.c is used, then the hooks in alloc.c are used, so >> they should be thread safe. >=20 > No, alloc_mutex only protects the variables __malloc_hook etc., but > not for the heap itself. Consider the following scenario: >=20 > 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. You are correct. Can we, should we fix this, i.e. make gmalloc.c thread = safe? Jan D.