diff options
author | Chad MILLER <chad@mysql.com> | 2009-01-12 14:48:02 -0500 |
---|---|---|
committer | Chad MILLER <chad@mysql.com> | 2009-01-12 14:48:02 -0500 |
commit | f4d0b4760ac5ea78c20c8f88321576b1456683d9 (patch) | |
tree | f16d3f2a058d8f454dca077bf73f01e651981382 /mysys/my_init.c | |
parent | 1a6452a208566af6bf30ce91e7154ff11ca485d3 (diff) | |
download | mariadb-git-f4d0b4760ac5ea78c20c8f88321576b1456683d9.tar.gz |
Bug#38364: gen_lex_hash segmentation fault in debug build
Bug#36428: MY_MUTEX_INIT_FAST is used before initialization
On some thread implementations, we need a fake mutex attri-
bute as a placeholder, which we define as a global variable,
"my_fast_mutexattr". Well. that must be initialized before
used in any mutexes, and the ordering of initializations in
the API function my_init() was wrong.
Now, put my_thread_global_init(), which initializes the attri-
butes that mutexes require.
Diffstat (limited to 'mysys/my_init.c')
-rw-r--r-- | mysys/my_init.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mysys/my_init.c b/mysys/my_init.c index 4b45d5ddc1a..0eec242818d 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -78,8 +78,12 @@ my_bool my_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ init_glob_errs(); -#if defined(THREAD) && defined(SAFE_MUTEX) +#if defined(THREAD) + if (my_thread_global_init()) + return 1; +# if defined(SAFE_MUTEX) safe_mutex_global_init(); /* Must be called early */ +# endif #endif #if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) fastmutex_global_init(); /* Must be called early */ @@ -89,8 +93,6 @@ my_bool my_init(void) #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif - if (my_thread_global_init()) - return 1; #if !defined( __WIN__) && !defined(__NETWARE__) sigfillset(&my_signals); /* signals blocked by mf_brkhant */ #endif |