• gkodinov/kgeorge@magare.gmz's avatar
    Bug #28284: Test "mysqlslap" reports "out of memory" · 63d18a60
    gkodinov/kgeorge@magare.gmz 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()
    63d18a60
my_pthread.h 26.3 KB