diff options
author | MySQL Team <mysql@php.net> | 2001-01-23 16:48:50 +0000 |
---|---|---|
committer | MySQL Team <mysql@php.net> | 2001-01-23 16:48:50 +0000 |
commit | 800f555b707c696798877c80352ded46289e87c4 (patch) | |
tree | c540242b6e6da4e9b99b46797a26b215abef0a64 /ext/mysql/libmysql/my_thr_init.c | |
parent | d36858681a0d48414702524ebd16f31289b06fa8 (diff) | |
download | php-git-800f555b707c696798877c80352ded46289e87c4.tar.gz |
Upgrade ext/mysql/libmysql to version 3.23.32. One notable bug fix is
that the client can now connect to a server which is using a default
charset other than latin1.
Diffstat (limited to 'ext/mysql/libmysql/my_thr_init.c')
-rw-r--r-- | ext/mysql/libmysql/my_thr_init.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/mysql/libmysql/my_thr_init.c b/ext/mysql/libmysql/my_thr_init.c index 9196d9b7af..2992d483d5 100644 --- a/ext/mysql/libmysql/my_thr_init.c +++ b/ext/mysql/libmysql/my_thr_init.c @@ -21,9 +21,6 @@ pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache, #ifndef HAVE_LOCALTIME_R pthread_mutex_t LOCK_localtime_r; #endif -#ifdef __WIN__ -pthread_mutex_t THR_LOCK_thread; -#endif /* FIXME Note. TlsAlloc does not set an auto destructor, so the function my_thread_global_free must be called from @@ -46,7 +43,7 @@ my_bool my_thread_global_init(void) pthread_mutex_init(&THR_LOCK_net,NULL); pthread_mutex_init(&THR_LOCK_charset,NULL); #ifdef __WIN__ - pthread_mutex_init(&THR_LOCK_thread,NULL); + win_pthread_init(); #endif #ifndef HAVE_LOCALTIME_R pthread_mutex_init(&LOCK_localtime_r,NULL); @@ -63,10 +60,19 @@ void my_thread_global_end(void) static long thread_id=0; +/* + We can't use mutex_locks here if we are 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)) { @@ -84,9 +90,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; @@ -94,7 +102,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; } |