~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/thr_lock.h

  • Committer: Olaf van der Spek
  • Date: 2011-10-26 12:03:22 UTC
  • mto: This revision was merged to the branch mainline in revision 2456.
  • Revision ID: olafvdspek@gmail.com-20111026120322-njk994x6jappi66p
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
extern uint64_t max_write_lock_count;
29
29
extern uint64_t table_lock_wait_timeout;
30
30
 
31
 
 
32
 
enum thr_lock_type { TL_IGNORE=-1,
 
31
enum thr_lock_type 
 
32
 
33
                     TL_IGNORE=-1,
33
34
                     /* UNLOCK ANY LOCK */
34
35
                     TL_UNLOCK,
35
36
                     /* Read lock */
62
63
                     /* Normal WRITE lock */
63
64
                     TL_WRITE,
64
65
                     /* Abort new lock request with an error */
65
 
                     TL_WRITE_ONLY};
66
 
 
67
 
enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
68
 
                            THR_LOCK_WAIT_TIMEOUT= 2, THR_LOCK_DEADLOCK= 3 };
 
66
                     TL_WRITE_ONLY
 
67
};
 
68
 
 
69
enum enum_thr_lock_result 
 
70
 
71
  THR_LOCK_SUCCESS= 0, 
 
72
  THR_LOCK_ABORTED= 1,
 
73
  THR_LOCK_WAIT_TIMEOUT= 2, 
 
74
  THR_LOCK_DEADLOCK= 3 
 
75
};
 
76
 
69
77
/*
70
78
  A description of the thread which owns the lock. The address
71
79
  of an instance of this structure is used to uniquely identify the thread.
96
104
  THR_LOCK_INFO *info;
97
105
 
98
106
  THR_LOCK_OWNER() :
99
 
    info(0)
 
107
    info(NULL)
100
108
  { }
101
109
 
102
110
};
104
112
struct THR_LOCK;
105
113
struct THR_LOCK_DATA;
106
114
 
107
 
struct DRIZZLED_API THR_LOCK_DATA {
 
115
struct DRIZZLED_API THR_LOCK_DATA 
 
116
{
108
117
  THR_LOCK_OWNER *owner;
109
118
  struct THR_LOCK_DATA *next,**prev;
110
119
  struct THR_LOCK *lock;
122
131
    status_param(0)
123
132
  { }
124
133
 
125
 
  void init(THR_LOCK *lock,
126
 
            void *status_param= NULL);
 
134
  void init(THR_LOCK*, void *status_param= NULL);
127
135
};
128
136
 
129
 
struct st_lock_list {
 
137
struct st_lock_list 
 
138
{
130
139
  THR_LOCK_DATA *data,**last;
131
140
 
132
141
  st_lock_list() :
135
144
  { }
136
145
};
137
146
 
138
 
struct THR_LOCK {
 
147
struct THR_LOCK 
 
148
{
139
149
private:
140
150
  boost::mutex mutex;
141
151
public:
171
181
  }
172
182
};
173
183
 
174
 
#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
175
184
DRIZZLED_API void thr_lock_init(THR_LOCK *lock);
176
 
enum enum_thr_lock_result thr_multi_lock(Session &session, THR_LOCK_DATA **data,
177
 
                                         uint32_t count, THR_LOCK_OWNER *owner);
178
 
void thr_multi_unlock(THR_LOCK_DATA **data,uint32_t count);
 
185
enum_thr_lock_result thr_multi_lock(Session&, THR_LOCK_DATA**, uint32_t count, THR_LOCK_OWNER*);
 
186
void thr_multi_unlock(THR_LOCK_DATA**, uint32_t count);
179
187
 
180
188
} /* namespace drizzled */
181
189