comparison src/gmalloc.c @ 78441:06446146e55e

(__malloc_initialize): Remove pthread_once. Not needed.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Tue, 07 Aug 2007 09:04:33 +0000
parents c4c2bb082d62
children a08858da19bd
comparison
equal deleted inserted replaced
78440:4fa26746dfc9 78441:06446146e55e
580 while (--blocks > 0) 580 while (--blocks > 0)
581 _heapinfo[block + blocks].busy.info.size = -blocks; 581 _heapinfo[block + blocks].busy.info.size = -blocks;
582 } 582 }
583 583
584 #ifdef USE_PTHREAD 584 #ifdef USE_PTHREAD
585 static pthread_once_t malloc_init_once_control = PTHREAD_ONCE_INIT;
586 pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER; 585 pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER;
587 pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER; 586 pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER;
588 int _malloc_thread_enabled_p; 587 int _malloc_thread_enabled_p;
589 588
590 static void 589 static void
654 __malloc_initialized = 1; 653 __malloc_initialized = 1;
655 PROTECT_MALLOC_STATE (1); 654 PROTECT_MALLOC_STATE (1);
656 return; 655 return;
657 } 656 }
658 657
659 /* Set everything up and remember that we have. */ 658 /* Set everything up and remember that we have.
659 main will call malloc which calls this function. That is before any threads
660 or signal handlers has been set up, so we don't need thread protection. */
660 int 661 int
661 __malloc_initialize () 662 __malloc_initialize ()
662 { 663 {
663 #ifdef USE_PTHREAD
664 pthread_once (&malloc_init_once_control, malloc_initialize_1);
665 #else
666 if (__malloc_initialized) 664 if (__malloc_initialized)
667 return 0; 665 return 0;
668 666
669 malloc_initialize_1 (); 667 malloc_initialize_1 ();
670 #endif
671 668
672 return __malloc_initialized; 669 return __malloc_initialized;
673 } 670 }
674 671
675 static int morecore_recursing; 672 static int morecore_recursing;