summaryrefslogtreecommitdiff
path: root/mysys/my_thr_init.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2009-02-19 11:01:25 +0200
committerMichael Widenius <monty@askmonty.org>2009-02-19 11:01:25 +0200
commit945fa0d913a65c447306e945c44f50828903445b (patch)
tree5178630451a60c8da965c19e0c339eb4f629de2f /mysys/my_thr_init.c
parent8526274c21ce0fd7eedac5275cb210cd2b048dc5 (diff)
parent6a1bc662d67cdb7716480654ddd63d504508b4fa (diff)
downloadmariadb-git-945fa0d913a65c447306e945c44f50828903445b.tar.gz
Merge with mysql-maria tree
mysql-test/t/variables.test: Reset delay_key_write, otherwise maria.maria test may fail sql/set_var.cc: Reset ha_open_options if one resets the delay_key_write variable. Before there was no way to reset it without restarting mysqld, which caused some tests to fail
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r--mysys/my_thr_init.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 252ad9f203e..716552bc31b 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -59,6 +59,38 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused)))
#endif /* TARGET_OS_LINUX */
+
+/**
+ Initialize thread attributes.
+*/
+
+void my_threadattr_global_init(void)
+{
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ /*
+ Set mutex type to "fast" a.k.a "adaptive"
+
+ In this case the thread may steal the mutex from some other thread
+ that is waiting for the same mutex. This will save us some
+ context switches but may cause a thread to 'starve forever' while
+ waiting for the mutex (not likely if the code within the mutex is
+ short).
+ */
+ pthread_mutexattr_init(&my_fast_mutexattr); /* ?= MY_MUTEX_INIT_FAST */
+ pthread_mutexattr_settype(&my_fast_mutexattr,
+ PTHREAD_MUTEX_ADAPTIVE_NP);
+#endif
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ /*
+ Set mutex type to "errorcheck"
+ */
+ pthread_mutexattr_init(&my_errorcheck_mutexattr);
+ pthread_mutexattr_settype(&my_errorcheck_mutexattr,
+ PTHREAD_MUTEX_ERRORCHECK);
+#endif
+}
+
+
static uint get_thread_lib(void);
/*