From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: Pretest? Date: Thu, 15 Mar 2007 21:08:10 +0900 (JST) Message-ID: <20070315.210810.236560633.mituharu@math.s.chiba-u.ac.jp> References: <45EBC39C.1080706@swipnet.se> <45F92841.3090600@swipnet.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1173960555 5044 80.91.229.12 (15 Mar 2007 12:09:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Mar 2007 12:09:15 +0000 (UTC) Cc: keramida@ceid.upatras.gr, cyd@stupidchicken.com, emacs-devel@gnu.org To: jan.h.d@swipnet.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 15 13:09:05 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 1HRolS-0005eo-LV for ged-emacs-devel@m.gmane.org; Thu, 15 Mar 2007 13:09:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HRomS-0003dI-1d for ged-emacs-devel@m.gmane.org; Thu, 15 Mar 2007 07:10:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HRomP-0003d1-AE for emacs-devel@gnu.org; Thu, 15 Mar 2007 08:10:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HRomN-0003ci-L2 for emacs-devel@gnu.org; Thu, 15 Mar 2007 08:10:00 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HRomN-0003cf-E2 for emacs-devel@gnu.org; Thu, 15 Mar 2007 07:09:59 -0500 Original-Received: from ntp.math.s.chiba-u.ac.jp ([133.82.132.2] helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HRolM-0007w6-So for emacs-devel@gnu.org; Thu, 15 Mar 2007 08:08:57 -0400 Original-Received: from localhost (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 23F0E2CAA; Thu, 15 Mar 2007 21:08:23 +0900 (JST) In-Reply-To: <45F92841.3090600@swipnet.se> X-Mailer: Mew version 3.3 on Emacs 22.0 / Mule 5.0 (SAKAKI) X-detected-kernel: NetBSD 3.0 (DF) 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:67957 Archived-At: >>>>> On Thu, 15 Mar 2007 12:04:33 +0100, Jan Dj=E4rv 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. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp