diff options
author | unknown <serg@janus.mylan> | 2007-03-28 15:33:29 +0200 |
---|---|---|
committer | unknown <serg@janus.mylan> | 2007-03-28 15:33:29 +0200 |
commit | f8eed3c1cef8049a81839fb8d526719437bc0d0b (patch) | |
tree | 7792d65ad629928aed16128c025294a9afd94492 /mysys/my_thr_init.c | |
parent | 143151229f0fc7954c3135cddde87b34e4e9f73c (diff) | |
download | mariadb-git-f8eed3c1cef8049a81839fb8d526719437bc0d0b.tar.gz |
restored run-time thread lib detection
sql/stacktrace.c:
removed code duplication
sql/stacktrace.h:
removed code duplication
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r-- | mysys/my_thr_init.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 61e6e640027..464edb77f99 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -20,6 +20,7 @@ #include "mysys_priv.h" #include <m_string.h> +#include <signal.h> #ifdef THREAD #ifdef USE_TLS @@ -63,6 +64,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused))) #endif +static uint get_thread_lib(void); + /* initialize thread environment @@ -76,6 +79,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused))) my_bool my_thread_global_init(void) { + thd_lib_detected= get_thread_lib(); + if (pthread_key_create(&THR_KEY_mysys,0)) { fprintf(stderr,"Can't initialize threads: error %d\n",errno); @@ -395,4 +400,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 */ |