]>
Commit | Line | Data |
---|---|---|
ae100190 ER |
1 | ## fix-dummy-thread-race-condition.dpatch by <mkoegler@auto.tuwien.ac.at> |
2 | ## | |
3 | ## Avoid dummy thread for pthread_exit workaround | |
4 | ||
ed2a7af1 ER |
5 | --- mysql-5.1.40/mysys/my_thr_init.c~ 2009-10-06 20:49:02.000000000 +0300 |
6 | +++ mysql-5.1.40/mysys/my_thr_init.c 2009-10-27 15:01:59.807275693 +0200 | |
7 | @@ -47,24 +47,6 @@ | |
ae100190 ER |
8 | pthread_mutexattr_t my_errorcheck_mutexattr; |
9 | #endif | |
10 | ||
11 | -#ifdef TARGET_OS_LINUX | |
12 | - | |
13 | -/* | |
ed2a7af1 ER |
14 | - Dummy thread spawned in my_thread_global_init() below to avoid |
15 | - race conditions in NPTL pthread_exit code. | |
ae100190 ER |
16 | -*/ |
17 | - | |
18 | -static pthread_handler_t | |
ed2a7af1 | 19 | -nptl_pthread_exit_hack_handler(void *arg __attribute((unused))) |
ae100190 ER |
20 | -{ |
21 | - /* Do nothing! */ | |
22 | - pthread_exit(0); | |
23 | - return 0; | |
24 | -} | |
25 | - | |
26 | -#endif /* TARGET_OS_LINUX */ | |
ed2a7af1 | 27 | - |
ae100190 ER |
28 | - |
29 | static uint get_thread_lib(void); | |
30 | ||
31 | /* | |
ed2a7af1 | 32 | @@ -89,33 +71,6 @@ |
ae100190 ER |
33 | return 1; |
34 | } | |
35 | ||
36 | -#ifdef TARGET_OS_LINUX | |
37 | - /* | |
38 | - BUG#24507: Race conditions inside current NPTL pthread_exit() | |
39 | - implementation. | |
40 | - | |
41 | - To avoid a possible segmentation fault during concurrent | |
42 | - executions of pthread_exit(), a dummy thread is spawned which | |
43 | - initializes internal variables of pthread lib. See bug description | |
44 | - for a full explanation. | |
45 | - | |
46 | - TODO: Remove this code when fixed versions of glibc6 are in common | |
47 | - use. | |
48 | - */ | |
49 | - if (thd_lib_detected == THD_LIB_NPTL) | |
50 | - { | |
51 | - pthread_t dummy_thread; | |
52 | - pthread_attr_t dummy_thread_attr; | |
53 | - | |
54 | - pthread_attr_init(&dummy_thread_attr); | |
55 | - pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_JOINABLE); | |
56 | - | |
57 | - if (pthread_create(&dummy_thread,&dummy_thread_attr, | |
58 | - nptl_pthread_exit_hack_handler, NULL) == 0) | |
59 | - (void)pthread_join(dummy_thread, NULL); | |
60 | - } | |
61 | -#endif /* TARGET_OS_LINUX */ | |
62 | - | |
63 | #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP | |
64 | /* | |
65 | Set mutex type to "fast" a.k.a "adaptive" |