# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1186477473 0 # Node ID 06446146e55ea50dfa73be32cec9980e94bdc549 # Parent 4fa26746dfc9659a18963f45bf509102d0d36785 (__malloc_initialize): Remove pthread_once. Not needed. diff -r 4fa26746dfc9 -r 06446146e55e src/gmalloc.c --- a/src/gmalloc.c Tue Aug 07 09:02:32 2007 +0000 +++ b/src/gmalloc.c Tue Aug 07 09:04:33 2007 +0000 @@ -582,7 +582,6 @@ } #ifdef USE_PTHREAD -static pthread_once_t malloc_init_once_control = PTHREAD_ONCE_INIT; pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER; int _malloc_thread_enabled_p; @@ -656,18 +655,16 @@ return; } -/* Set everything up and remember that we have. */ +/* Set everything up and remember that we have. + main will call malloc which calls this function. That is before any threads + or signal handlers has been set up, so we don't need thread protection. */ int __malloc_initialize () { -#ifdef USE_PTHREAD - pthread_once (&malloc_init_once_control, malloc_initialize_1); -#else if (__malloc_initialized) return 0; malloc_initialize_1 (); -#endif return __malloc_initialized; }