summaryrefslogtreecommitdiff
path: root/storage/xtradb/sync
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-06-28 22:01:55 +0200
committerSergei Golubchik <serg@mariadb.org>2016-06-28 22:01:55 +0200
commit3361aee591b1eb8c676f60887ffc535cd509890a (patch)
tree54a65f83ba7d9293e6f8e8281ad920fbae6eb823 /storage/xtradb/sync
parent6ce20fb2b9fe57330c797694b9dbea4028f40d7c (diff)
parent0fdb17e6c3f50ae22eb97b6363bcbd8b0cd9e040 (diff)
downloadmariadb-git-3361aee591b1eb8c676f60887ffc535cd509890a.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'storage/xtradb/sync')
-rw-r--r--storage/xtradb/sync/sync0arr.cc12
-rw-r--r--storage/xtradb/sync/sync0rw.cc16
-rw-r--r--storage/xtradb/sync/sync0sync.cc36
3 files changed, 24 insertions, 40 deletions
diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc
index d881c5de2f5..c311d2cbd7d 100644
--- a/storage/xtradb/sync/sync0arr.cc
+++ b/storage/xtradb/sync/sync0arr.cc
@@ -336,21 +336,21 @@ sync_cell_get_event(
ulint type = cell->request_type;
if (type == SYNC_MUTEX) {
- return(((ib_mutex_t*) cell->wait_object)->event);
+ return(&((ib_mutex_t*) cell->wait_object)->event);
} else if (type == SYNC_PRIO_MUTEX) {
- return(((ib_prio_mutex_t*) cell->wait_object)
+ return(&((ib_prio_mutex_t*) cell->wait_object)
->high_priority_event);
} else if (type == RW_LOCK_WAIT_EX) {
- return(((rw_lock_t*) cell->wait_object)->wait_ex_event);
+ return(&((rw_lock_t*) cell->wait_object)->wait_ex_event);
} else if (type == PRIO_RW_LOCK_SHARED) {
- return(((prio_rw_lock_t *) cell->wait_object)
+ return(&((prio_rw_lock_t *) cell->wait_object)
->high_priority_s_event);
} else if (type == PRIO_RW_LOCK_EX) {
- return(((prio_rw_lock_t *) cell->wait_object)
+ return(&((prio_rw_lock_t *) cell->wait_object)
->high_priority_x_event);
} else { /* RW_LOCK_SHARED and RW_LOCK_EX wait on the same event */
ut_ad(type == RW_LOCK_SHARED || type == RW_LOCK_EX);
- return(((rw_lock_t*) cell->wait_object)->event);
+ return(&((rw_lock_t*) cell->wait_object)->event);
}
}
diff --git a/storage/xtradb/sync/sync0rw.cc b/storage/xtradb/sync/sync0rw.cc
index 00fb5e511a4..729f510013d 100644
--- a/storage/xtradb/sync/sync0rw.cc
+++ b/storage/xtradb/sync/sync0rw.cc
@@ -261,8 +261,8 @@ rw_lock_create_func(
lock->last_x_file_name = "not yet reserved";
lock->last_s_line = 0;
lock->last_x_line = 0;
- lock->event = os_event_create();
- lock->wait_ex_event = os_event_create();
+ os_event_create(&lock->event);
+ os_event_create(&lock->wait_ex_event);
mutex_enter(&rw_lock_list_mutex);
@@ -304,9 +304,9 @@ rw_lock_create_func(
cline);
lock->high_priority_s_waiters = 0;
- lock->high_priority_s_event = os_event_create();
+ os_event_create(&lock->high_priority_s_event);
lock->high_priority_x_waiters = 0;
- lock->high_priority_x_event = os_event_create();
+ os_event_create(&lock->high_priority_x_event);
lock->high_priority_wait_ex_waiter = 0;
}
@@ -334,9 +334,9 @@ rw_lock_free_func(
mutex = rw_lock_get_mutex(lock);
#endif /* !INNODB_RW_LOCKS_USE_ATOMICS */
- os_event_free(lock->event);
+ os_event_free(&lock->event, false);
- os_event_free(lock->wait_ex_event);
+ os_event_free(&lock->wait_ex_event, false);
ut_ad(UT_LIST_GET_PREV(list, lock) == NULL
|| UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
@@ -366,8 +366,8 @@ rw_lock_free_func(
/*==============*/
prio_rw_lock_t* lock) /*!< in: rw-lock */
{
- os_event_free(lock->high_priority_s_event);
- os_event_free(lock->high_priority_x_event);
+ os_event_free(&lock->high_priority_s_event, false);
+ os_event_free(&lock->high_priority_x_event, false);
rw_lock_free_func(&lock->base_lock);
}
diff --git a/storage/xtradb/sync/sync0sync.cc b/storage/xtradb/sync/sync0sync.cc
index 702dd240f16..c699fbf2ded 100644
--- a/storage/xtradb/sync/sync0sync.cc
+++ b/storage/xtradb/sync/sync0sync.cc
@@ -212,10 +212,7 @@ UNIV_INTERN mysql_pfs_key_t sync_thread_mutex_key;
/** Global list of database mutexes (not OS mutexes) created. */
UNIV_INTERN ut_list_base_node_t mutex_list;
-/** Global list of priority mutexes. A subset of mutex_list */
-UNIV_INTERN UT_LIST_BASE_NODE_T(ib_prio_mutex_t) prio_mutex_list;
-
-/** Mutex protecting the mutex_list and prio_mutex_list variables */
+/** Mutex protecting the mutex_list variable */
UNIV_INTERN ib_mutex_t mutex_list_mutex;
#ifdef UNIV_PFS_MUTEX
@@ -280,7 +277,7 @@ mutex_create_func(
os_fast_mutex_init(PFS_NOT_INSTRUMENTED, &mutex->os_fast_mutex);
mutex->lock_word = 0;
#endif
- mutex->event = os_event_create();
+ os_event_create(&mutex->event);
mutex_set_waiters(mutex, 0);
#ifdef UNIV_DEBUG
mutex->magic_n = MUTEX_MAGIC_N;
@@ -349,11 +346,7 @@ mutex_create_func(
cline,
cmutex_name);
mutex->high_priority_waiters = 0;
- mutex->high_priority_event = os_event_create();
-
- mutex_enter(&mutex_list_mutex);
- UT_LIST_ADD_FIRST(list, prio_mutex_list, mutex);
- mutex_exit(&mutex_list_mutex);
+ os_event_create(&mutex->high_priority_event);
}
/******************************************************************//**
@@ -400,7 +393,7 @@ mutex_free_func(
mutex_exit(&mutex_list_mutex);
}
- os_event_free(mutex->event);
+ os_event_free(&mutex->event, false);
#ifdef UNIV_MEM_DEBUG
func_exit:
#endif /* UNIV_MEM_DEBUG */
@@ -427,12 +420,8 @@ mutex_free_func(
/*============*/
ib_prio_mutex_t* mutex) /*!< in: mutex */
{
- mutex_enter(&mutex_list_mutex);
- UT_LIST_REMOVE(list, prio_mutex_list, mutex);
- mutex_exit(&mutex_list_mutex);
-
ut_a(mutex->high_priority_waiters == 0);
- os_event_free(mutex->high_priority_event);
+ os_event_free(&mutex->high_priority_event, false);
mutex_free_func(&mutex->base_mutex);
}
@@ -722,7 +711,7 @@ mutex_signal_object(
/* The memory order of resetting the waiters field and
signaling the object is important. See LEMMA 1 above. */
- os_event_set(mutex->event);
+ os_event_set(&mutex->event);
sync_array_object_signalled();
}
@@ -1555,7 +1544,6 @@ sync_init(void)
/* Init the mutex list and create the mutex to protect it. */
UT_LIST_INIT(mutex_list);
- UT_LIST_INIT(prio_mutex_list);
mutex_create(mutex_list_mutex_key, &mutex_list_mutex,
SYNC_NO_ORDER_CHECK);
#ifdef UNIV_SYNC_DEBUG
@@ -1602,22 +1590,17 @@ sync_thread_level_arrays_free(void)
#endif /* UNIV_SYNC_DEBUG */
/******************************************************************//**
-Frees the resources in InnoDB's own synchronization data structures. Use
-os_sync_free() after calling this. */
+Frees the resources in InnoDB's own synchronization data structures. */
UNIV_INTERN
void
sync_close(void)
/*===========*/
{
ib_mutex_t* mutex;
- ib_prio_mutex_t* prio_mutex;
sync_array_close();
- for (prio_mutex = UT_LIST_GET_FIRST(prio_mutex_list); prio_mutex;) {
- mutex_free(prio_mutex);
- prio_mutex = UT_LIST_GET_FIRST(prio_mutex_list);
- }
+ mutex_free(&rw_lock_list_mutex);
for (mutex = UT_LIST_GET_FIRST(mutex_list);
mutex != NULL;
@@ -1635,7 +1618,6 @@ sync_close(void)
mutex = UT_LIST_GET_FIRST(mutex_list);
}
- mutex_free(&mutex_list_mutex);
#ifdef UNIV_SYNC_DEBUG
mutex_free(&sync_thread_mutex);
@@ -1646,6 +1628,8 @@ sync_close(void)
os_fast_mutex_free(&rw_lock_debug_mutex);
#endif /* UNIV_SYNC_DEBUG */
+ mutex_free(&mutex_list_mutex);
+
sync_initialized = FALSE;
}