diff options
author | unknown <jani@hynda.mysql.fi> | 2007-08-16 17:25:48 +0300 |
---|---|---|
committer | unknown <jani@hynda.mysql.fi> | 2007-08-16 17:25:48 +0300 |
commit | 4e5d02e99f44b012671ade0373cf1c11a573abc4 (patch) | |
tree | 9e4be342c1902f1f07919c81d4e32925ef1632c0 /include | |
parent | de619bd17c69453dc115fad746719b0751de87f5 (diff) | |
download | mariadb-git-4e5d02e99f44b012671ade0373cf1c11a573abc4.tar.gz |
Fix for Bug#27970 "Fix for bug 24507 makes mysql_install_db fail"
include/my_pthread.h:
Fix for Bug#27970 "Fix for bug 24507 makes mysql_install_db fail".
Removed macro NPTL_PTHREAD_EXIT_BUG, because it doesn't work in dynamic
environment. One can switch between NPTL and LT on the fly on Linux.
Added pthread_dummy(ESRCH) for those platforms that don't have pthread_kill.
This ensures that there won't be an error in mysqld.cc where the return value
is being checked from the function call.
mysys/my_thr_init.c:
Check for a Linux is enough. There is an additional test if
NPTL is in use before spwaning the extra thread.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_pthread.h | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h index d64b5348666..1cedbbc4fd0 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -30,25 +30,6 @@ extern "C" { #define EXTERNC #endif /* __cplusplus */ -/* - BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. - - If macro NPTL_PTHREAD_EXIT_HACK is defined then a hack described in the bug - report will be implemented inside my_thread_global_init() in my_thr_init.c. - - This amounts to spawning a dummy thread which does nothing but executes - pthread_exit(0). - - This bug is fixed in version 2.5 of glibc library. - - TODO: Remove this code when fixed versions of glibc6 are in common use. - */ - -#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && \ - defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 ) -#define NPTL_PTHREAD_EXIT_BUG 1 -#endif - #if defined(__WIN__) || defined(OS2) #ifdef OS2 @@ -199,7 +180,7 @@ extern int pthread_mutex_destroy (pthread_mutex_t *); #define pthread_mutex_unlock(A) LeaveCriticalSection(A) #define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) -#define pthread_kill(A,B) pthread_dummy(0) +#define pthread_kill(A,B) pthread_dummy(ESRCH) #endif /* OS2 */ /* Dummy defines for easier code */ @@ -463,14 +444,14 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) #define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) -#define pthread_kill(A,B) pthread_dummy(0) +#define pthread_kill(A,B) pthread_dummy(ESRCH) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } #endif #ifdef HAVE_DARWIN5_THREADS #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) -#define pthread_kill(A,B) pthread_dummy(0) +#define pthread_kill(A,B) pthread_dummy(ESRCH) #define pthread_condattr_init(A) pthread_dummy(0) #define pthread_condattr_destroy(A) pthread_dummy(0) #undef pthread_detach_this_thread @@ -490,7 +471,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #ifndef pthread_sigmask #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) #endif -#define pthread_kill(A,B) pthread_dummy(0) +#define pthread_kill(A,B) pthread_dummy(ESRCH) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } #elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ @@ -717,6 +698,11 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr; #define MY_MUTEX_INIT_ERRCHK NULL #endif +#ifndef ESRCH +/* Define it to something */ +#define ESRCH 1 +#endif + extern my_bool my_thread_global_init(void); extern void my_thread_global_end(void); extern my_bool my_thread_init(void); |