summaryrefslogtreecommitdiff
path: root/include/thr_lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/thr_lock.h')
-rw-r--r--include/thr_lock.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/include/thr_lock.h b/include/thr_lock.h
index fb70c57c0e7..800467f32cd 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -82,6 +82,12 @@ enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
THR_LOCK_WAIT_TIMEOUT= 2, THR_LOCK_DEADLOCK= 3 };
+/* Priority for locks */
+#define THR_LOCK_LATE_PRIV 1 /* For locks to be merged with org lock */
+#define THR_LOCK_MERGE_PRIV 2 /* For merge tables */
+
+#define THR_UNLOCK_UPDATE_STATUS 1
+
extern ulong max_write_lock_count;
extern ulong table_lock_wait_timeout;
extern my_bool thr_lock_inited;
@@ -116,9 +122,11 @@ typedef struct st_thr_lock_data {
struct st_thr_lock_data *next,**prev;
struct st_thr_lock *lock;
pthread_cond_t *cond;
- enum thr_lock_type type;
void *status_param; /* Param to status functions */
- void *debug_print_param;
+ void *debug_print_param; /* For error messages */
+ enum thr_lock_type type;
+ enum thr_lock_type org_type; /* Cache for MariaDB */
+ uint priority;
} THR_LOCK_DATA;
struct st_lock_list {
@@ -135,11 +143,15 @@ typedef struct st_thr_lock {
/* write_lock_count is incremented for write locks and reset on read locks */
ulong write_lock_count;
uint read_no_write_count;
- void (*get_status)(void*, int); /* When one gets a lock */
+ void (*get_status)(void*, my_bool); /* When one gets a lock */
void (*copy_status)(void*,void*);
void (*update_status)(void*); /* Before release of write */
- void (*restore_status)(void*); /* Before release of read */
+ void (*restore_status)(void*); /* Before release of read */
+ my_bool (*start_trans)(void*); /* When all locks are taken */
my_bool (*check_status)(void *);
+ void (*fix_status)(void *, void *);/* For thr_merge_locks() */
+ const char *name; /* Used for error reporting */
+ my_bool allow_multiple_concurrent_insert;
} THR_LOCK;
@@ -153,13 +165,11 @@ void thr_lock_init(THR_LOCK *lock);
void thr_lock_delete(THR_LOCK *lock);
void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
void *status_param);
-enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data,
- THR_LOCK_OWNER *owner,
- enum thr_lock_type lock_type);
-void thr_unlock(THR_LOCK_DATA *data);
+void thr_unlock(THR_LOCK_DATA *data, uint unlock_flags);
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
uint count, THR_LOCK_OWNER *owner);
-void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
+void thr_multi_unlock(THR_LOCK_DATA **data,uint count, uint unlock_flags);
+void thr_merge_locks(THR_LOCK_DATA **data, uint org_count, uint new_count);
void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock);
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
void thr_print_locks(void); /* For debugging */