diff options
author | unknown <monty@mysql.com> | 2003-12-11 06:24:32 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2003-12-11 06:24:32 +0200 |
commit | 28b1f63aa7f6ed40d68c932cfe33420c12c7347d (patch) | |
tree | 35f5e63ae1da09573a4496dfd0ced99b9d70ae97 /mysys/my_thr_init.c | |
parent | 7cfbc5e9336099d4b850e6a7e8282ade3e7aef19 (diff) | |
parent | 287661e66cc1fea6730b357bb56d48c6d065ef43 (diff) | |
download | mariadb-git-28b1f63aa7f6ed40d68c932cfe33420c12c7347d.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/my/mysql-4.0
mysys/my_thr_init.c:
Auto merged
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r-- | mysys/my_thr_init.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 3196256facc..57eecd7b746 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -44,12 +44,23 @@ pthread_mutexattr_t my_fast_mutexattr; pthread_mutexattr_t my_errchk_mutexattr; #endif +/* + initialize thread environment + + SYNOPSIS + my_thread_global_init() + + RETURN + 0 ok + 1 error (Couldn't create THR_KEY_mysys) +*/ + my_bool my_thread_global_init(void) { - if (pthread_key_create(&THR_KEY_mysys,free)) + if (pthread_key_create(&THR_KEY_mysys,0)) { fprintf(stderr,"Can't initialize threads: error %d\n",errno); - exit(1); + return 1; } #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP pthread_mutexattr_init(&my_fast_mutexattr); @@ -79,15 +90,18 @@ my_bool my_thread_global_init(void) #ifndef HAVE_GETHOSTBYNAME_R pthread_mutex_init(&LOCK_gethostbyname_r,MY_MUTEX_INIT_SLOW); #endif - return my_thread_init(); + if (my_thread_init()) + { + my_thread_global_end(); /* Clean up */ + return 1; + } + return 0; } void my_thread_global_end(void) { -#if defined(USE_TLS) - (void) TlsFree(THR_KEY_mysys); -#endif + pthread_key_delete(THR_KEY_mysys); #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP pthread_mutexattr_destroy(&my_fast_mutexattr); #endif |