Loading include/my_global.h +1 −4 Original line number Diff line number Diff line Loading @@ -454,10 +454,7 @@ int __void__; #endif /* Define some useful general macros */ #if defined(__cplusplus) && defined(__GNUC__) #define max(a, b) ((a) >? (b)) #define min(a, b) ((a) <? (b)) #elif !defined(max) #if !defined(max) #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #endif Loading include/my_pthread.h +10 −8 Original line number Diff line number Diff line Loading @@ -30,14 +30,6 @@ extern "C" { #define EXTERNC #endif /* __cplusplus */ /* Thread library */ #define THD_LIB_OTHER 1 #define THD_LIB_NPTL 2 #define THD_LIB_LT 4 extern uint thd_lib_detected; /* BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. Loading Loading @@ -771,6 +763,16 @@ extern uint my_thread_end_wait_time; Keep track of shutdown,signal, and main threads so that my_end() will not report errors with them */ /* Which kind of thread library is in use */ #define THD_LIB_OTHER 1 #define THD_LIB_NPTL 2 #define THD_LIB_LT 4 extern uint thd_lib_detected; extern uint thr_client_alarm; /* statistics_xxx functions are for not essential statistic */ #ifndef thread_safe_increment Loading include/thr_alarm.h +2 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,8 @@ typedef struct st_alarm { my_bool malloced; } ALARM; extern uint thr_client_alarm; #define thr_alarm_init(A) (*(A))=0 #define thr_alarm_in_use(A) (*(A)!= 0) void init_thr_alarm(uint max_alarm); Loading mysys/my_pthread.c +4 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #endif uint thd_lib_detected; uint thr_client_alarm; #ifndef my_pthread_setprio void my_pthread_setprio(pthread_t thread_id,int prior) Loading Loading @@ -337,7 +338,9 @@ void *sigwait_thread(void *set_arg) sigaction(i, &sact, (struct sigaction*) 0); } } sigaddset(set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); /* Ensure that init_thr_alarm() is called */ DBUG_ASSERT(thr_client_alarm); sigaddset(set, thr_client_alarm); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0); alarm_thread=pthread_self(); /* For thr_alarm */ Loading mysys/my_thr_init.c +25 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include "mysys_priv.h" #include <m_string.h> #include <signal.h> #ifdef THREAD #ifdef USE_TLS Loading Loading @@ -63,6 +64,8 @@ pthread_handler_t nptl_pthread_exit_hack_handler(void *arg) #endif static uint get_thread_lib(void); /* initialize thread environment Loading @@ -76,6 +79,12 @@ pthread_handler_t nptl_pthread_exit_hack_handler(void *arg) my_bool my_thread_global_init(void) { thd_lib_detected= get_thread_lib(); if (thd_lib_detected == THD_LIB_LT) thr_client_alarm= SIGALRM; else thr_client_alarm= SIGUSR1; if (pthread_key_create(&THR_KEY_mysys,0)) { fprintf(stderr,"Can't initialize threads: error %d\n",errno); Loading Loading @@ -392,4 +401,20 @@ const char *my_thread_name(void) } #endif /* DBUG_OFF */ static uint get_thread_lib(void) { char buff[64]; #ifdef _CS_GNU_LIBPTHREAD_VERSION confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); if (!strncasecmp(buff, "NPTL", 4)) return THD_LIB_NPTL; if (!strncasecmp(buff, "linuxthreads", 12)) return THD_LIB_LT; #endif return THD_LIB_OTHER; } #endif /* THREAD */ Loading
include/my_global.h +1 −4 Original line number Diff line number Diff line Loading @@ -454,10 +454,7 @@ int __void__; #endif /* Define some useful general macros */ #if defined(__cplusplus) && defined(__GNUC__) #define max(a, b) ((a) >? (b)) #define min(a, b) ((a) <? (b)) #elif !defined(max) #if !defined(max) #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #endif Loading
include/my_pthread.h +10 −8 Original line number Diff line number Diff line Loading @@ -30,14 +30,6 @@ extern "C" { #define EXTERNC #endif /* __cplusplus */ /* Thread library */ #define THD_LIB_OTHER 1 #define THD_LIB_NPTL 2 #define THD_LIB_LT 4 extern uint thd_lib_detected; /* BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. Loading Loading @@ -771,6 +763,16 @@ extern uint my_thread_end_wait_time; Keep track of shutdown,signal, and main threads so that my_end() will not report errors with them */ /* Which kind of thread library is in use */ #define THD_LIB_OTHER 1 #define THD_LIB_NPTL 2 #define THD_LIB_LT 4 extern uint thd_lib_detected; extern uint thr_client_alarm; /* statistics_xxx functions are for not essential statistic */ #ifndef thread_safe_increment Loading
include/thr_alarm.h +2 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,8 @@ typedef struct st_alarm { my_bool malloced; } ALARM; extern uint thr_client_alarm; #define thr_alarm_init(A) (*(A))=0 #define thr_alarm_in_use(A) (*(A)!= 0) void init_thr_alarm(uint max_alarm); Loading
mysys/my_pthread.c +4 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #endif uint thd_lib_detected; uint thr_client_alarm; #ifndef my_pthread_setprio void my_pthread_setprio(pthread_t thread_id,int prior) Loading Loading @@ -337,7 +338,9 @@ void *sigwait_thread(void *set_arg) sigaction(i, &sact, (struct sigaction*) 0); } } sigaddset(set, thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1); /* Ensure that init_thr_alarm() is called */ DBUG_ASSERT(thr_client_alarm); sigaddset(set, thr_client_alarm); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0); alarm_thread=pthread_self(); /* For thr_alarm */ Loading
mysys/my_thr_init.c +25 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include "mysys_priv.h" #include <m_string.h> #include <signal.h> #ifdef THREAD #ifdef USE_TLS Loading Loading @@ -63,6 +64,8 @@ pthread_handler_t nptl_pthread_exit_hack_handler(void *arg) #endif static uint get_thread_lib(void); /* initialize thread environment Loading @@ -76,6 +79,12 @@ pthread_handler_t nptl_pthread_exit_hack_handler(void *arg) my_bool my_thread_global_init(void) { thd_lib_detected= get_thread_lib(); if (thd_lib_detected == THD_LIB_LT) thr_client_alarm= SIGALRM; else thr_client_alarm= SIGUSR1; if (pthread_key_create(&THR_KEY_mysys,0)) { fprintf(stderr,"Can't initialize threads: error %d\n",errno); Loading Loading @@ -392,4 +401,20 @@ const char *my_thread_name(void) } #endif /* DBUG_OFF */ static uint get_thread_lib(void) { char buff[64]; #ifdef _CS_GNU_LIBPTHREAD_VERSION confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); if (!strncasecmp(buff, "NPTL", 4)) return THD_LIB_NPTL; if (!strncasecmp(buff, "linuxthreads", 12)) return THD_LIB_LT; #endif return THD_LIB_OTHER; } #endif /* THREAD */