comparison src/alloc.c @ 80502:07f3d63ad3d3

[!SYSTEM_MALLOC && !SYNC_INPUT] (uninterrupt_malloc) [HAVE_GTK_AND_PTHREAD && !DOUG_LEA_MALLOC]: Don't use recursive mutex.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sat, 12 Apr 2008 01:58:56 +0000
parents fc2bcd2a8aad
children acd89d089f05 ca9efc5939fc
comparison
equal deleted inserted replaced
80501:9699ee3d1437 80502:07f3d63ad3d3
1354 1354
1355 void 1355 void
1356 uninterrupt_malloc () 1356 uninterrupt_malloc ()
1357 { 1357 {
1358 #ifdef HAVE_GTK_AND_PTHREAD 1358 #ifdef HAVE_GTK_AND_PTHREAD
1359 #ifdef DOUG_LEA_MALLOC
1359 pthread_mutexattr_t attr; 1360 pthread_mutexattr_t attr;
1360 1361
1361 /* GLIBC has a faster way to do this, but lets keep it portable. 1362 /* GLIBC has a faster way to do this, but lets keep it portable.
1362 This is according to the Single UNIX Specification. */ 1363 This is according to the Single UNIX Specification. */
1363 pthread_mutexattr_init (&attr); 1364 pthread_mutexattr_init (&attr);
1364 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); 1365 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
1365 pthread_mutex_init (&alloc_mutex, &attr); 1366 pthread_mutex_init (&alloc_mutex, &attr);
1367 #else /* !DOUG_LEA_MALLOC */
1368 /* Some systems such as Solaris 2.6 doesn't have a recursive mutex,
1369 and the bundled gmalloc.c doesn't require it. */
1370 pthread_mutex_init (&alloc_mutex, NULL);
1371 #endif /* !DOUG_LEA_MALLOC */
1366 #endif /* HAVE_GTK_AND_PTHREAD */ 1372 #endif /* HAVE_GTK_AND_PTHREAD */
1367 1373
1368 if (__free_hook != emacs_blocked_free) 1374 if (__free_hook != emacs_blocked_free)
1369 old_free_hook = __free_hook; 1375 old_free_hook = __free_hook;
1370 __free_hook = emacs_blocked_free; 1376 __free_hook = emacs_blocked_free;