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: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump) Date: Wed, 01 Aug 2007 13:53:57 +0200 Message-ID: <46B07455.4000504@swipnet.se> References: <46AA17BD.7080900@netasq.com> <46AC6849.1010400@swipnet.se> <20070731190955.GA11917@oslo.ath.cx> <46B0505A.9010208@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: 7bit X-Trace: sea.gmane.org 1185969304 23622 80.91.229.12 (1 Aug 2007 11:55:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Aug 2007 11:55:04 +0000 (UTC) Cc: "Herbert J. Skuhra" , emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 01 13:54:57 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 1IGCn2-0003o3-U5 for ged-emacs-devel@m.gmane.org; Wed, 01 Aug 2007 13:54:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IGCn0-00047l-Bw for ged-emacs-devel@m.gmane.org; Wed, 01 Aug 2007 07:54:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IGCmw-00046m-H5 for emacs-devel@gnu.org; Wed, 01 Aug 2007 07:54:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IGCmt-0003zY-Lv for emacs-devel@gnu.org; Wed, 01 Aug 2007 07: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 1IGCmt-0003zH-Fo for emacs-devel@gnu.org; Wed, 01 Aug 2007 07:54:47 -0400 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 1IGCms-0001bb-QA for emacs-devel@gnu.org; Wed, 01 Aug 2007 07:54:47 -0400 Original-Received: by av9-2-sn2.hy.skanova.net (Postfix, from userid 502) id DD1803828D; Wed, 1 Aug 2007 13:54:45 +0200 (CEST) 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 B1D9C37F70; Wed, 1 Aug 2007 13:54:45 +0200 (CEST) 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 9E53D37E42; Wed, 1 Aug 2007 13:54:45 +0200 (CEST) User-Agent: Thunderbird 2.0.0.5 (X11/20070719) In-Reply-To: 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:75900 Archived-At: YAMAMOTO Mitsuharu skrev: >>>>>> On Wed, 01 Aug 2007 19:07:47 +0900, YAMAMOTO Mitsuharu said: > >> It might be possible to call pthread_mutex_init for all malloc >> mutexes at the (non-thread-safe) initialization stage with >> temporarily disabling the use of the mutexes. > > Could you try if this works? As usual, I can't test it myself. I think we should call LOCK/UNLOCK on them also just to be sure. You never know what those BDS guys are up to :-) Jan D. > > YAMAMOTO Mitsuharu > mituharu@math.s.chiba-u.ac.jp > > Index: src/gmalloc.c > =================================================================== > RCS file: /cvsroot/emacs/emacs/src/gmalloc.c,v > retrieving revision 1.24 > diff -c -p -r1.24 gmalloc.c > *** src/gmalloc.c 29 Jul 2007 10:12:21 -0000 1.24 > --- src/gmalloc.c 1 Aug 2007 10:35:05 -0000 > *************** extern void _free_internal_nolock PP ((_ > *** 242,249 **** > > #ifdef USE_PTHREAD > extern pthread_mutex_t _malloc_mutex, _aligned_blocks_mutex; > ! #define LOCK() pthread_mutex_lock (&_malloc_mutex) > ! #define UNLOCK() pthread_mutex_unlock (&_malloc_mutex) > #define LOCK_ALIGNED_BLOCKS() pthread_mutex_lock (&_aligned_blocks_mutex) > #define UNLOCK_ALIGNED_BLOCKS() pthread_mutex_unlock (&_aligned_blocks_mutex) > #else > --- 242,256 ---- > > #ifdef USE_PTHREAD > extern pthread_mutex_t _malloc_mutex, _aligned_blocks_mutex; > ! extern int _malloc_mutex_disabled_p; > ! #define LOCK() \ > ! do { \ > ! if (!_malloc_mutex_disabled_p) pthread_mutex_lock (&_malloc_mutex); \ > ! } while (0) > ! #define UNLOCK() \ > ! do { \ > ! if (!_malloc_mutex_disabled_p) pthread_mutex_unlock (&_malloc_mutex); \ > ! } while (0) > #define LOCK_ALIGNED_BLOCKS() pthread_mutex_lock (&_aligned_blocks_mutex) > #define UNLOCK_ALIGNED_BLOCKS() pthread_mutex_unlock (&_aligned_blocks_mutex) > #else > *************** register_heapinfo () > *** 563,568 **** > --- 570,576 ---- > #ifdef USE_PTHREAD > pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER; > pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER; > + int _malloc_mutex_disabled_p; > #endif > > static void > *************** __malloc_initialize () > *** 617,622 **** > --- 625,641 ---- > > malloc_initialize_1 (); > > + /* Some pthread implementations call malloc for statically > + initialized mutexes when they are used first. To avoid such a > + situation, we initialize mutexes here with temporarily disabling > + the use of mutexes. */ > + #ifdef USE_PTHREAD > + _malloc_mutex_disabled_p = 1; > + pthread_mutex_init (&_malloc_mutex, NULL); > + pthread_mutex_init (&_aligned_blocks_mutex, NULL); > + _malloc_mutex_disabled_p = 0; > + #endif > + > return __malloc_initialized; > } > > > > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel