]>
Commit | Line | Data |
---|---|---|
b9c8dcd3 | 1 | ## fix-dummy-thread-race-condition.dpatch by <mkoegler@auto.tuwien.ac.at> |
2 | ## | |
3 | ## Avoid dummy thread for pthread_exit workaround | |
4 | ||
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 | |
7 | @@ -47,23 +47,6 @@ | |
8 | pthread_mutexattr_t my_errorcheck_mutexattr; | |
9 | #endif | |
10 | ||
11 | -#ifdef TARGET_OS_LINUX | |
12 | - | |
13 | -/* | |
14 | - Dummy thread spawned in my_thread_global_init() below to avoid | |
15 | - race conditions in NPTL pthread_exit code. | |
16 | -*/ | |
17 | - | |
18 | -static pthread_handler_t | |
19 | -nptl_pthread_exit_hack_handler(void *arg __attribute__((unused))) | |
20 | -{ | |
21 | - /* Do nothing! */ | |
22 | - pthread_exit(0); | |
23 | - return 0; | |
24 | -} | |
25 | - | |
26 | -#endif /* TARGET_OS_LINUX */ | |
27 | - | |
28 | static uint get_thread_lib(void); | |
29 | ||
30 | /* | |
31 | @@ -71,33 +71,6 @@ | |
32 | return 1; | |
33 | } | |
34 | ||
35 | -#ifdef TARGET_OS_LINUX | |
36 | - /* | |
37 | - BUG#24507: Race conditions inside current NPTL pthread_exit() | |
38 | - implementation. | |
39 | - | |
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. | |
44 | - | |
45 | - TODO: Remove this code when fixed versions of glibc6 are in common | |
46 | - use. | |
47 | - */ | |
48 | - if (thd_lib_detected == THD_LIB_NPTL) | |
49 | - { | |
50 | - pthread_t dummy_thread; | |
51 | - pthread_attr_t dummy_thread_attr; | |
52 | - | |
53 | - pthread_attr_init(&dummy_thread_attr); | |
54 | - pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_JOINABLE); | |
55 | - | |
56 | - if (pthread_create(&dummy_thread,&dummy_thread_attr, | |
57 | - nptl_pthread_exit_hack_handler, NULL) == 0) | |
58 | - (void)pthread_join(dummy_thread, NULL); | |
59 | - } | |
60 | -#endif /* TARGET_OS_LINUX */ | |
61 | - | |
62 | #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP | |
63 | /* | |
64 | Set mutex type to "fast" a.k.a "adaptive" |