[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump)
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump) |
Date: |
Wed, 01 Aug 2007 19:42:31 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.1.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Wed, 01 Aug 2007 19:07:47 +0900, YAMAMOTO Mitsuharu <address@hidden>
>>>>> 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.
YAMAMOTO Mitsuharu
address@hidden
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;
}
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), YAMAMOTO Mitsuharu, 2007/08/01
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), Jan Djärv, 2007/08/01
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), Jan D., 2007/08/01
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), YAMAMOTO Mitsuharu, 2007/08/06
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), YAMAMOTO Mitsuharu, 2007/08/06
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), Herbert J. Skuhra, 2007/08/06
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), Ryan Yeske, 2007/08/06
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), Jan Djärv, 2007/08/07
- Re: emacs-unicode-2 bootstrap on FreeBSD (temacs coredump), YAMAMOTO Mitsuharu, 2007/08/07