~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_thr_init.c

  • Committer: Jay Pipes
  • Date: 2008-07-17 20:11:46 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080717201146-s2flcwwq0q89ac1y
Phase 3 removal of DBUG in mysys

Show diffs side-by-side

added added

removed removed

Lines of Context:
279
279
  tmp->id= ++thread_id;
280
280
  ++THR_thread_count;
281
281
  pthread_mutex_unlock(&THR_LOCK_threads);
282
 
#ifndef DBUG_OFF
283
 
  /* Generate unique name for thread */
284
 
  (void) my_thread_name();
285
 
#endif
286
282
 
287
283
end:
288
284
  return error;
312
308
#endif  
313
309
  if (tmp && tmp->init)
314
310
  {
315
 
#if !defined(DBUG_OFF)
316
 
    /* tmp->dbug is allocated inside DBUG library */
317
 
    if (tmp->dbug)
318
 
    {
319
 
      DBUG_POP();
320
 
      free(tmp->dbug);
321
 
      tmp->dbug=0;
322
 
    }
323
 
#endif
324
311
#if !defined(__bsdi__) && !defined(__OpenBSD__)
325
312
 /* bsdi and openbsd 3.5 dumps core here */
326
313
    pthread_cond_destroy(&tmp->suspend);
336
323
      Decrement counter for number of running threads. We are using this
337
324
      in my_thread_global_end() to wait until all threads have called
338
325
      my_thread_end and thus freed all memory they have allocated in
339
 
      my_thread_init() and DBUG_xxxx
 
326
      my_thread_init() 
340
327
    */
341
328
    pthread_mutex_lock(&THR_LOCK_threads);
342
 
    DBUG_ASSERT(THR_thread_count != 0);
 
329
    assert(THR_thread_count != 0);
343
330
    if (--THR_thread_count == 0)
344
331
      pthread_cond_signal(&THR_COND_threads);
345
332
   pthread_mutex_unlock(&THR_LOCK_threads);
374
361
  return my_thread_var->id;
375
362
}
376
363
 
377
 
#ifdef DBUG_OFF
378
 
const char *my_thread_name(void)
379
 
{
380
 
  return "no_name";
381
 
}
382
 
 
383
 
#else
384
 
 
385
 
const char *my_thread_name(void)
386
 
{
387
 
  char name_buff[100];
388
 
  struct st_my_thread_var *tmp=my_thread_var;
389
 
  if (!tmp->name[0])
390
 
  {
391
 
    my_thread_id id= my_thread_dbug_id();
392
 
    sprintf(name_buff,"T@%lu", (ulong) id);
393
 
    strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
394
 
  }
395
 
  return tmp->name;
396
 
}
397
 
#endif /* DBUG_OFF */
398
 
 
399
 
 
400
364
static uint get_thread_lib(void)
401
365
{
402
366
#ifdef _CS_GNU_LIBPTHREAD_VERSION