30
extern pthread_mutex_t THR_LOCK_lock;
33
26
extern uint64_t max_write_lock_count;
34
27
extern uint64_t table_lock_wait_timeout;
35
extern bool thr_lock_inited;
38
30
enum thr_lock_type { TL_IGNORE=-1,
90
89
structure is used as id.
93
typedef struct st_thr_lock_owner
95
94
THR_LOCK_INFO *info;
99
typedef struct st_thr_lock_data {
103
struct THR_LOCK_DATA;
105
struct THR_LOCK_DATA {
100
106
THR_LOCK_OWNER *owner;
101
struct st_thr_lock_data *next,**prev;
102
struct st_thr_lock *lock;
107
struct THR_LOCK_DATA *next,**prev;
108
struct THR_LOCK *lock;
103
109
pthread_cond_t *cond;
104
110
enum thr_lock_type type;
105
111
void *status_param; /* Param to status functions */
108
124
struct st_lock_list {
109
125
THR_LOCK_DATA *data,**last;
112
typedef struct st_thr_lock {
113
134
pthread_mutex_t mutex;
114
135
struct st_lock_list read_wait;
115
136
struct st_lock_list read;
118
139
/* write_lock_count is incremented for write locks and reset on read locks */
119
140
uint32_t write_lock_count;
120
141
uint32_t read_no_write_count;
121
void (*get_status)(void*, int); /* When one gets a lock */
122
void (*copy_status)(void*,void*);
123
void (*update_status)(void*); /* Before release of write */
124
void (*restore_status)(void*); /* Before release of read */
125
bool (*check_status)(void *);
129
bool init_thr_lock(void); /* Must be called once/thread */
145
read_no_write_count(0)
152
bool abort_locks_for_thread(uint64_t thread);
156
pthread_mutex_lock(&mutex);
161
pthread_mutex_unlock(&mutex);
166
pthread_mutex_init(&mutex, NULL);
171
pthread_mutex_destroy(&mutex);
174
pthread_mutex_t *native_handle()
130
181
#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
131
182
void thr_lock_info_init(THR_LOCK_INFO *info);
132
183
void thr_lock_init(THR_LOCK *lock);
133
184
void thr_lock_delete(THR_LOCK *lock);
134
185
void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
186
void *status_param= NULL);
136
187
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
137
188
uint32_t count, THR_LOCK_OWNER *owner);
138
189
void thr_multi_unlock(THR_LOCK_DATA **data,uint32_t count);
139
void thr_abort_locks(THR_LOCK *lock);
140
bool thr_abort_locks_for_thread(THR_LOCK *lock, uint64_t thread);
142
191
} /* namespace drizzled */