summaryrefslogtreecommitdiff
path: root/mysys/my_thr_init.c
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2007-02-01 08:09:36 +0100
committerunknown <istruewing@chilla.local>2007-02-01 08:09:36 +0100
commit62fdcb54a7e03282b19b8661e0f78e766e3b2a36 (patch)
tree048257cd44bd6d69572262aba31071a54e7992f1 /mysys/my_thr_init.c
parenta94b1b50772271e1e4e72ddb237eff458380c0fa (diff)
parent7be3cad45d0dccb3538fe797c9ac81358f92f691 (diff)
downloadmariadb-git-62fdcb54a7e03282b19b8661e0f78e766e3b2a36.tar.gz
Merge chilla.local:/home/mydev/mysql-4.0-axmrg
into chilla.local:/home/mydev/mysql-4.1-axmrg include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/thr_alarm.h: Auto merged mysys/default.c: Auto merged mysys/my_pthread.c: Auto merged mysys/thr_alarm.c: Auto merged mysys/my_thr_init.c: Manual merged sql/mysqld.cc: Manual merged
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r--mysys/my_thr_init.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 878e1f6bfc6..34fa2e8aa7e 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -21,6 +21,7 @@
#include "mysys_priv.h"
#include <m_string.h>
+#include <signal.h>
#ifdef THREAD
#ifdef USE_TLS
@@ -44,6 +45,8 @@ pthread_mutexattr_t my_fast_mutexattr;
pthread_mutexattr_t my_errorcheck_mutexattr;
#endif
+static uint get_thread_lib(void);
+
/*
initialize thread environment
@@ -57,6 +60,12 @@ pthread_mutexattr_t my_errorcheck_mutexattr;
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);
@@ -290,4 +299,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 */