comparison src/gmalloc.c @ 82198:8cc259bc54fd

(__malloc_initialize): Remove pthread_once. Not needed.
author Jan Dj?rv <jan.h.d@swipnet.se>
date Sun, 29 Jul 2007 10:12:21 +0000
parents 059caeb1f502
children 7856255721ef 539530fa389c
comparison
equal deleted inserted replaced
82197:f12fa3610e5a 82198:8cc259bc54fd
559 while (--blocks > 0) 559 while (--blocks > 0)
560 _heapinfo[block + blocks].busy.info.size = -blocks; 560 _heapinfo[block + blocks].busy.info.size = -blocks;
561 } 561 }
562 562
563 #ifdef USE_PTHREAD 563 #ifdef USE_PTHREAD
564 static pthread_once_t malloc_init_once_control = PTHREAD_ONCE_INIT;
565 pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER; 564 pthread_mutex_t _malloc_mutex = PTHREAD_MUTEX_INITIALIZER;
566 pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER; 565 pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER;
567 #endif 566 #endif
568 567
569 static void 568 static void
605 __malloc_initialized = 1; 604 __malloc_initialized = 1;
606 PROTECT_MALLOC_STATE (1); 605 PROTECT_MALLOC_STATE (1);
607 return; 606 return;
608 } 607 }
609 608
610 /* Set everything up and remember that we have. */ 609 /* Set everything up and remember that we have.
610 main will call malloc which calls this function. That is before any threads
611 or signal handlers has been set up, so we don't need thread protection. */
611 int 612 int
612 __malloc_initialize () 613 __malloc_initialize ()
613 { 614 {
614 #ifdef USE_PTHREAD
615 pthread_once (&malloc_init_once_control, malloc_initialize_1);
616 #else
617 if (__malloc_initialized) 615 if (__malloc_initialized)
618 return 0; 616 return 0;
619 617
620 malloc_initialize_1 (); 618 malloc_initialize_1 ();
621 #endif
622 619
623 return __malloc_initialized; 620 return __malloc_initialized;
624 } 621 }
625 622
626 static int morecore_recursing; 623 static int morecore_recursing;