~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_thr_init.cc

  • Committer: Brian Aker
  • Date: 2008-11-22 02:53:34 UTC
  • Revision ID: brian@tangent.org-20081122025334-me4nekbor2xk3iq8
Refactor out dead mutexes

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#else
43
43
pthread_key_t THR_KEY_mysys;
44
44
#endif /* USE_TLS */
45
 
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,
46
 
                THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap,
47
 
                THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads, THR_LOCK_time;
 
45
pthread_mutex_t THR_LOCK_open;
 
46
pthread_mutex_t THR_LOCK_lock;
 
47
pthread_mutex_t THR_LOCK_myisam;
 
48
pthread_mutex_t THR_LOCK_charset; 
 
49
pthread_mutex_t THR_LOCK_threads; 
 
50
pthread_mutex_t THR_LOCK_time;
48
51
pthread_cond_t  THR_COND_threads;
49
52
uint32_t            THR_thread_count= 0;
50
53
uint32_t                my_thread_end_wait_time= 5;
104
107
    return 1;
105
108
  }
106
109
 
107
 
#ifdef TARGET_OS_LINUX
108
 
  /*
109
 
    BUG#24507: Race conditions inside current NPTL pthread_exit()
110
 
    implementation.
111
 
 
112
 
    To avoid a possible segmentation fault during concurrent
113
 
    executions of pthread_exit(), a dummy thread is spawned which
114
 
    initializes internal variables of pthread lib. See bug description
115
 
    for a full explanation.
116
 
 
117
 
    TODO: Remove this code when fixed versions of glibc6 are in common
118
 
    use.
119
 
  */
120
 
  if (thd_lib_detected == THD_LIB_NPTL)
121
 
  {
122
 
    pthread_t       dummy_thread;
123
 
    pthread_attr_t  dummy_thread_attr;
124
 
 
125
 
    pthread_attr_init(&dummy_thread_attr);
126
 
    pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_DETACHED);
127
 
 
128
 
    pthread_create(&dummy_thread,&dummy_thread_attr,
129
 
                   nptl_pthread_exit_hack_handler, NULL);
130
 
  }
131
 
#endif /* TARGET_OS_LINUX */
132
 
 
133
110
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
134
111
  /*
135
112
    Set mutex type to "fast" a.k.a "adaptive"
153
130
                            PTHREAD_MUTEX_ERRORCHECK);
154
131
#endif
155
132
 
156
 
  pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST);
157
133
  pthread_mutex_init(&THR_LOCK_open,MY_MUTEX_INIT_FAST);
158
134
  pthread_mutex_init(&THR_LOCK_lock,MY_MUTEX_INIT_FAST);
159
 
  pthread_mutex_init(&THR_LOCK_isam,MY_MUTEX_INIT_SLOW);
160
135
  pthread_mutex_init(&THR_LOCK_myisam,MY_MUTEX_INIT_SLOW);
161
 
  pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
162
 
  pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
163
136
  pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
164
137
  pthread_mutex_init(&THR_LOCK_threads,MY_MUTEX_INIT_FAST);
165
138
  pthread_mutex_init(&THR_LOCK_time,MY_MUTEX_INIT_FAST);
216
189
#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
217
190
  pthread_mutexattr_destroy(&my_errorcheck_mutexattr);
218
191
#endif
219
 
  pthread_mutex_destroy(&THR_LOCK_malloc);
220
192
  pthread_mutex_destroy(&THR_LOCK_open);
221
193
  pthread_mutex_destroy(&THR_LOCK_lock);
222
 
  pthread_mutex_destroy(&THR_LOCK_isam);
223
194
  pthread_mutex_destroy(&THR_LOCK_myisam);
224
 
  pthread_mutex_destroy(&THR_LOCK_heap);
225
 
  pthread_mutex_destroy(&THR_LOCK_net);
226
195
  pthread_mutex_destroy(&THR_LOCK_time);
227
196
  pthread_mutex_destroy(&THR_LOCK_charset);
228
197
  if (all_threads_killed)