mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
This commit is contained in:
@ -46,6 +46,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
|
||||
|
||||
@ -64,6 +81,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
|
||||
/*
|
||||
|
Reference in New Issue
Block a user