~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_thr_init.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-13 15:08:14 UTC
  • mto: This revision was merged to the branch mainline in revision 2407.
  • Revision ID: olafvdspek@gmail.com-20110813150814-x12xd0c230a9bgtb
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
boost::thread_specific_ptr<st_my_thread_var> THR_KEY_mysys;
49
49
boost::mutex THR_LOCK_threads;
50
50
 
51
 
/*
52
 
  initialize thread environment
53
 
 
54
 
  SYNOPSIS
55
 
    my_thread_global_init()
56
 
 
57
 
  RETURN
58
 
    0  ok
59
 
    1  error (Couldn't create THR_KEY_mysys)
60
 
*/
61
 
 
62
 
void my_thread_global_init()
63
 
{
64
 
  my_thread_init();
65
 
}
66
 
 
67
 
 
68
51
static uint64_t thread_id= 0;
69
52
 
70
53
/*
80
63
 
81
64
void my_thread_init()
82
65
{
83
 
  // We should mever see my_thread_init()  called twice
 
66
  // We should never see my_thread_init() called twice
84
67
  if (THR_KEY_mysys.get())
85
68
  {
86
69
    abort();
89
72
  THR_KEY_mysys.reset(new st_my_thread_var(++thread_id));
90
73
}
91
74
 
92
 
st_my_thread_var* _my_thread_var()
 
75
st_my_thread_var* my_thread_var()
93
76
{
94
77
  return THR_KEY_mysys.get();
95
78
}