1 ## fix-dummy-thread-race-condition.dpatch by <mkoegler@auto.tuwien.ac.at>
3 ## Avoid dummy thread for pthread_exit workaround
5 --- mysql-5.0.87/mysys/my_thr_init.c~ 2009-10-27 13:28:45.000000000 +0200
6 +++ mysql-5.0.87/mysys/my_thr_init.c 2009-10-27 13:29:49.502552171 +0200
8 pthread_mutexattr_t my_errorcheck_mutexattr;
11 -#ifdef TARGET_OS_LINUX
14 - Dummy thread spawned in my_thread_global_init() below to avoid
15 - race conditions in NPTL pthread_exit code.
18 -static pthread_handler_t
19 -nptl_pthread_exit_hack_handler(void *arg __attribute__((unused)))
26 -#endif /* TARGET_OS_LINUX */
28 static uint get_thread_lib(void);
35 -#ifdef TARGET_OS_LINUX
37 - BUG#24507: Race conditions inside current NPTL pthread_exit()
40 - To avoid a possible segmentation fault during concurrent
41 - executions of pthread_exit(), a dummy thread is spawned which
42 - initializes internal variables of pthread lib. See bug description
43 - for a full explanation.
45 - TODO: Remove this code when fixed versions of glibc6 are in common
48 - if (thd_lib_detected == THD_LIB_NPTL)
50 - pthread_t dummy_thread;
51 - pthread_attr_t dummy_thread_attr;
53 - pthread_attr_init(&dummy_thread_attr);
54 - pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_JOINABLE);
56 - if (pthread_create(&dummy_thread,&dummy_thread_attr,
57 - nptl_pthread_exit_hack_handler, NULL) == 0)
58 - (void)pthread_join(dummy_thread, NULL);
60 -#endif /* TARGET_OS_LINUX */
62 #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
64 Set mutex type to "fast" a.k.a "adaptive"