diff options
author | unknown <lars@mysql.com/black.(none)> | 2006-12-08 23:33:39 +0100 |
---|---|---|
committer | unknown <lars@mysql.com/black.(none)> | 2006-12-08 23:33:39 +0100 |
commit | cacaef6e44ed2fb7a42f5d3bfc713877a138a280 (patch) | |
tree | e603834affcc44ee4ccebccd7ce99351c3f56e77 /mysys/my_thr_init.c | |
parent | d5e094d798a20c44d442c48061c9e314a26c20c4 (diff) | |
parent | a79858049e3b00b13879e79f4379d9e90de775f4 (diff) | |
download | mariadb-git-cacaef6e44ed2fb7a42f5d3bfc713877a138a280.tar.gz |
Merge mysql.com:/home/bkroot/mysql-5.0-rpl
into mysql.com:/home/bk/MERGE/mysql-5.0-merge
client/mysqldump.c:
Auto merged
include/my_pthread.h:
Auto merged
mysql-test/r/mysqldump.result:
Auto merged
mysql-test/r/rpl_timezone.result:
Auto merged
mysql-test/t/disabled.def:
Auto merged
mysql-test/t/mysqldump.test:
Auto merged
mysys/my_thr_init.c:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r-- | mysys/my_thr_init.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index fcae18d4686..61953364937 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -47,6 +47,23 @@ pthread_mutexattr_t my_fast_mutexattr; pthread_mutexattr_t my_errorcheck_mutexattr; #endif +#ifdef NPTL_PTHREAD_EXIT_BUG /* see my_pthread.h */ + +/* + Dummy thread spawned in my_thread_global_init() below to avoid + race conditions in NPTL pthread_exit code. +*/ + +static +pthread_handler_t nptl_pthread_exit_hack_handler(void *arg) +{ + /* Do nothing! */ + pthread_exit(0); + return 0; +} + +#endif + /* initialize thread environment @@ -65,6 +82,28 @@ my_bool my_thread_global_init(void) fprintf(stderr,"Can't initialize threads: error %d\n",errno); return 1; } + +#ifdef NPTL_PTHREAD_EXIT_BUG + +/* + BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. + + To avoid a possible segmentation fault during concurrent executions of + pthread_exit(), a dummy thread is spawned which initializes internal variables + of pthread lib. See bug description for thoroughfull explanation. + + TODO: Remove this code when fixed versions of glibc6 are in common use. +*/ + + pthread_t dummy_thread; + pthread_attr_t dummy_thread_attr; + + pthread_attr_init(&dummy_thread_attr); + pthread_attr_setdetachstate(&dummy_thread_attr,PTHREAD_CREATE_DETACHED); + + pthread_create(&dummy_thread,&dummy_thread_attr,nptl_pthread_exit_hack_handler,NULL); + +#endif #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP /* |