24 #include <my_pthread.h>
28 extern ulong locks_immediate,locks_waited ;
34 enum thr_lock_type { TL_IGNORE=-1,
45 TL_READ_WITH_SHARED_LOCKS,
47 TL_READ_HIGH_PRIORITY,
60 TL_WRITE_CONCURRENT_INSERT,
69 TL_WRITE_LOW_PRIORITY,
75 enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
76 THR_LOCK_WAIT_TIMEOUT= 2, THR_LOCK_DEADLOCK= 3 };
79 extern ulong max_write_lock_count;
80 extern my_bool thr_lock_inited;
81 extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
91 my_thread_id thread_id;
100 enum thr_lock_type
type;
102 void *debug_print_param;
103 struct PSI_table *m_psi;
118 ulong write_lock_count;
119 uint read_no_write_count;
120 void (*get_status)(
void*, int);
121 void (*copy_status)(
void*,
void*);
122 void (*update_status)(
void*);
123 void (*restore_status)(
void*);
124 my_bool (*check_status)(
void *);
128 extern LIST *thr_lock_thread_list;
131 my_bool init_thr_lock(
void);
134 void thr_lock_delete(
THR_LOCK *lock);
139 enum thr_lock_type lock_type,
140 ulong lock_wait_timeout);
142 enum enum_thr_lock_result thr_multi_lock(
THR_LOCK_DATA **data,
144 ulong lock_wait_timeout);
148 void thr_abort_locks(
THR_LOCK *lock, my_bool upgrade_lock);
149 my_bool thr_abort_locks_for_thread(
THR_LOCK *lock, my_thread_id thread);
150 void thr_print_locks(
void);
152 enum thr_lock_type new_lock_type,
153 ulong lock_wait_timeout);
155 enum thr_lock_type new_lock_type);
157 ulong lock_wait_timeout);
158 void thr_set_lock_wait_callback(
void (*before_wait)(
void),
159 void (*after_wait)(
void));