From 06d80f111958ff9bebc9ccb4c58b9ba362484c00 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Aug 2007 18:06:44 +0300 Subject: Bug #28284: Test "mysqlslap" reports "out of memory" 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() --- mysys/my_init.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysys/my_init.c') diff --git a/mysys/my_init.c b/mysys/my_init.c index 257edb351b4..b2eefe97ee8 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -78,6 +78,9 @@ my_bool my_init(void) my_umask_dir= 0700; /* Default umask for new directories */ #if defined(THREAD) && defined(SAFE_MUTEX) safe_mutex_global_init(); /* Must be called early */ +#endif +#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) + fastmutex_global_init(); /* Must be called early */ #endif netware_init(); #ifdef THREAD -- cgit v1.2.1