From d7ab8899eb04d537c4e72abb4210502ad0b60893 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Dec 2003 21:45:19 +0400 Subject: Fix for #1890 and #1959 This bug happens under Windows & Embedded server Reason is that pthread_self() always returns NULL in this case. This confuses thr_lock function and it doesn't stop thread inserting in the write-locked table. Global problem is that there's no way under Windows to get unique thread handle for working thread. Monty made a workaround for server - we store the thread's handle we get when we create thread in the thread-specific variable. This doesn't work with the embedded library for we don't control thread creation there. I added code that sets CurrentThreadId as the pthread_self for the embedded library. It seems to solve problem because it's unique and we don't use pthread_self as a parameter for thread functions in embedded library. mysys/my_thr_init.c: setting of tmp->thread_self added --- mysys/my_thr_init.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysys/my_thr_init.c') diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 9f64e9dcb60..3196256facc 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -157,6 +157,9 @@ my_bool my_thread_init(void) tmp= &THR_KEY_mysys; #endif tmp->id= ++thread_id; +#if defined(__WIN__) && defined(EMBEDDED_LIBRARY) + tmp->thread_self= (pthread_t)getpid(); +#endif pthread_mutex_init(&tmp->mutex,MY_MUTEX_INIT_FAST); pthread_cond_init(&tmp->suspend, NULL); tmp->init= 1; -- cgit v1.2.1