diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2009-02-12 16:27:33 +0100 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2009-02-12 16:27:33 +0100 |
commit | b90ff5340fc10a9306be1b1201612e382b8ab051 (patch) | |
tree | 39a2faeb08864430d60c6db17a918a9ee3102fed /mysys/my_thr_init.c | |
parent | 704b4845aa9ce51a6c5a9f5f42265e376db0dfb3 (diff) | |
download | mariadb-git-b90ff5340fc10a9306be1b1201612e382b8ab051.tar.gz |
Fixing problems of previous 5.1-main->5.1-maria merge:
- adding back Serg's "mtr --list-options"
- safe_mutex deadlock detector started raising wrong deadlock warnings, fixed
here by a backport from 6.0-main.
include/my_pthread.h:
Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
mysql-test/mysql-test-run.pl:
adding back Serg's --list-options
mysys/my_init.c:
Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
mysys/my_thr_init.c:
Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r-- | mysys/my_thr_init.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 3f4c4a4d638..4617d0e2277 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -65,6 +65,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); /* |