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.h42
1 files changed, 14 insertions, 28 deletions
diff --git a/include/thr_lock.h b/include/thr_lock.h
index 08cc8bd5408..562ed30afd7 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -1,4 +1,4 @@
-/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -54,12 +54,6 @@ enum thr_lock_type { TL_IGNORE=-1,
*/
TL_WRITE_ALLOW_WRITE,
/*
- Write lock, but allow other threads to read.
- Used by ALTER TABLE in MySQL to allow readers
- to use the table until ALTER TABLE is finished.
- */
- TL_WRITE_ALLOW_READ,
- /*
WRITE lock used by concurrent insert. Will allow
READ, if one could use concurrent insert on table.
*/
@@ -89,7 +83,6 @@ enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
#define THR_UNLOCK_UPDATE_STATUS 1
extern ulong max_write_lock_count;
-extern ulong table_lock_wait_timeout;
extern my_bool thr_lock_inited;
extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
@@ -102,28 +95,17 @@ typedef struct st_thr_lock_info
{
pthread_t thread;
my_thread_id thread_id;
- ulong n_cursors;
} THR_LOCK_INFO;
-/*
- Lock owner identifier. Globally identifies the lock owner within the
- thread and among all the threads. The address of an instance of this
- structure is used as id.
-*/
-
-typedef struct st_thr_lock_owner
-{
- THR_LOCK_INFO *info;
-} THR_LOCK_OWNER;
-
typedef struct st_thr_lock_data {
- THR_LOCK_OWNER *owner;
+ THR_LOCK_INFO *owner;
struct st_thr_lock_data *next,**prev;
struct st_thr_lock *lock;
- pthread_cond_t *cond;
+ mysql_cond_t *cond;
void *status_param; /* Param to status functions */
void *debug_print_param;
+ struct PSI_table *m_psi;
enum thr_lock_type type;
uint priority;
} THR_LOCK_DATA;
@@ -134,7 +116,7 @@ struct st_lock_list {
typedef struct st_thr_lock {
LIST list;
- pthread_mutex_t mutex;
+ mysql_mutex_t mutex;
struct st_lock_list read_wait;
struct st_lock_list read;
struct st_lock_list write_wait;
@@ -154,10 +136,9 @@ typedef struct st_thr_lock {
extern LIST *thr_lock_thread_list;
-extern pthread_mutex_t THR_LOCK_lock;
+extern mysql_mutex_t THR_LOCK_lock;
my_bool init_thr_lock(void); /* Must be called once/thread */
-#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
void thr_lock_info_init(THR_LOCK_INFO *info);
void thr_lock_init(THR_LOCK *lock);
void thr_lock_delete(THR_LOCK *lock);
@@ -165,17 +146,22 @@ void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
void *status_param);
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);
+ uint count, THR_LOCK_INFO *owner,
+ ulong lock_wait_timeout);
void thr_multi_unlock(THR_LOCK_DATA **data,uint count, uint unlock_flags);
+#error keep both thr_merge* or what?
+void thr_lock_merge_status(THR_LOCK_DATA **data, uint count);
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 */
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data,
- enum thr_lock_type new_lock_type);
+ enum thr_lock_type new_lock_type,
+ ulong lock_wait_timeout);
void thr_downgrade_write_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type);
-my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data);
+my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data,
+ ulong lock_wait_timeout);
#ifdef __cplusplus
}
#endif