~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/signal_handler/signal_handler.cc

  • Committer: Brian Aker
  • Date: 2009-02-27 21:38:40 UTC
  • Revision ID: brian@tangent.org-20090227213840-r9hq3sfk8d8qrg72
Code cleanup in signal_handler.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
#endif /* HAVE_STACK_TRACE_ON_SEGV */
130
130
 
131
131
  /*
132
 
    signal to start_signal_handler that we are ready
133
 
    This works by waiting for start_signal_handler to free mutex,
 
132
    signal to init that we are ready
 
133
    This works by waiting for init to free mutex,
134
134
    after which we signal it that we are ready.
135
135
    At this pointer there is no other threads running, so there
136
136
    should not be any other pthread_cond_signal() calls.
190
190
}
191
191
 
192
192
 
193
 
static void start_signal_handler(void)
 
193
static int init(void *)
194
194
{
195
195
  int error;
196
196
  pthread_attr_t thr_attr;
227
227
  pthread_mutex_unlock(&LOCK_thread_count);
228
228
 
229
229
  (void) pthread_attr_destroy(&thr_attr);
230
 
  return;;
231
 
}
232
 
static int init(void *)
233
 
{
234
 
  start_signal_handler();
 
230
 
235
231
  return 0;
236
232
}
237
233
 
239
235
  This is mainly needed when running with purify, but it's still nice to
240
236
  know that all child threads have died when drizzled exits.
241
237
*/
242
 
static void wait_for_signal_thread_to_end()
 
238
static int deinit(void *)
243
239
{
244
240
  uint32_t i;
245
241
  /*
252
248
      break;
253
249
    usleep(100);                                // Give it time to die
254
250
  }
255
 
}
256
 
 
257
 
 
258
 
 
259
 
static int deinit(void *)
260
 
{
261
 
  wait_for_signal_thread_to_end();
262
251
 
263
252
  return 0;
264
253
}