• unknown's avatar
    Bug #28284: Test "mysqlslap" reports "out of memory" · 06d80f11
    unknown authored
    When locking a "fast" mutex a static variable cpu_count 
    was used as a flag to initialize itself on the first usage 
    by calling sysconf() and setting non-zero value.
    This is not thread and optimization safe on some 
    platforms. That's why the global initialization needs 
    to be done once in a designated function.
    This will also speed up the usage (by a small bit) 
    because it won't have to check if it's initialized on
    every call.
    
    Fixed by moving the fast mutexes initialization out of 
    my_pthread_fastmutex_lock() to fastmutex_global_init()
    and call it from my_init()
    
    
    include/my_pthread.h:
      Bug #28284: move the fast mutexes initialization out of 
      my_pthread_fastmutex_lock() to fastmutex_global_init()
      and call it from my_init()
    mysys/my_init.c:
      Bug #28284: move the fast mutexes initialization out of 
      my_pthread_fastmutex_lock() to fastmutex_global_init()
      and call it from my_init()
    mysys/thr_mutex.c:
      Bug #28284: move the fast mutexes initialization out of 
      my_pthread_fastmutex_lock() to fastmutex_global_init()
      and call it from my_init()
    06d80f11
my_pthread.h 26.3 KB