diff options
author | unknown <monty@donna.mysql.com> | 2000-09-20 19:37:35 +0300 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-09-20 19:37:35 +0300 |
commit | 73826420c3114dad809c2c051ba60a6e3f50ee20 (patch) | |
tree | 2c87a6bf075e8c202b7802333c934a5cddb7e747 /mysys/my_thr_init.c | |
parent | 7ae27ed3b7e43907f73c753535cb7fe90702084c (diff) | |
parent | 0d788b1e91e77b50bcd03359ad052f4795ae1c09 (diff) | |
download | mariadb-git-73826420c3114dad809c2c051ba60a6e3f50ee20.tar.gz |
Merge work:/home/bk/mysql into donna.mysql.com:/home/my/bk/mysql
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r-- | mysys/my_thr_init.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index d879da8e65d..6b75444f3fc 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -77,10 +77,19 @@ void my_thread_global_end(void) static long thread_id=0; +/* + We can't use mutex_locks here if we re using windows as + we may have compiled the program with SAFE_MUTEX, in which + case the checking of mutex_locks will not work until + the pthread_self thread specific variable is initialized. +*/ + my_bool my_thread_init(void) { struct st_my_thread_var *tmp; +#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX) pthread_mutex_lock(&THR_LOCK_lock); +#endif #if !defined(__WIN__) || defined(USE_TLS) if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys)) { @@ -98,9 +107,11 @@ my_bool my_thread_init(void) pthread_setspecific(THR_KEY_mysys,tmp); #else - if (THR_KEY_mysys.id) /* Allready initialized */ + if (THR_KEY_mysys.id) /* Already initialized */ { +#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX) pthread_mutex_unlock(&THR_LOCK_lock); +#endif return 0; } tmp= &THR_KEY_mysys; @@ -108,7 +119,9 @@ my_bool my_thread_init(void) tmp->id= ++thread_id; pthread_mutex_init(&tmp->mutex,NULL); pthread_cond_init(&tmp->suspend, NULL); +#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX) pthread_mutex_unlock(&THR_LOCK_lock); +#endif return 0; } |