diff options
author | heikki@hundin.mysql.fi <> | 2003-05-31 03:12:03 +0300 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2003-05-31 03:12:03 +0300 |
commit | 42671d18aed8d98b445a1abea8de56c0a2613b7c (patch) | |
tree | 028daf6927cddff18af2ae4c5bbc03a329c59dec /innobase/sync | |
parent | cfda0a16ffc759b0f96ae96e6092b72b9b3d5741 (diff) | |
download | mariadb-git-42671d18aed8d98b445a1abea8de56c0a2613b7c.tar.gz |
Many files:
Free all OS sync primitives and allocated memory in InnoDB shutdown
Diffstat (limited to 'innobase/sync')
-rw-r--r-- | innobase/sync/sync0sync.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index 20d68ba5a9f..32615ce88ac 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -235,8 +235,7 @@ mutex_create_func( mutex->cline = cline; /* Check that lock_word is aligned; this is important on Intel */ - - ut_a(((ulint)(&(mutex->lock_word))) % 4 == 0); + ut_ad(((ulint)(&(mutex->lock_word))) % 4 == 0); /* NOTE! The very first mutexes are not put to the mutex list */ @@ -266,11 +265,14 @@ mutex_free( ut_a(mutex_get_lock_word(mutex) == 0); ut_a(mutex_get_waiters(mutex) == 0); - mutex_enter(&mutex_list_mutex); + if (mutex != &mutex_list_mutex && mutex != &sync_thread_mutex) { - UT_LIST_REMOVE(list, mutex_list, mutex); + mutex_enter(&mutex_list_mutex); - mutex_exit(&mutex_list_mutex); + UT_LIST_REMOVE(list, mutex_list, mutex); + + mutex_exit(&mutex_list_mutex); + } #if !defined(_WIN32) || !defined(UNIV_CAN_USE_X86_ASSEMBLER) os_fast_mutex_free(&(mutex->os_fast_mutex)); @@ -1230,13 +1232,26 @@ sync_init(void) } /********************************************************************** -Frees the resources in synchronization data structures. */ +Frees the resources in InnoDB's own synchronization data structures. Use +os_sync_free() after calling this. */ void sync_close(void) /*===========*/ { + mutex_t* mutex; + sync_array_free(sync_primary_wait_array); + + mutex = UT_LIST_GET_FIRST(mutex_list); + + while (mutex) { + mutex_free(mutex); + mutex = UT_LIST_GET_FIRST(mutex_list); + } + + mutex_free(&mutex_list_mutex); + mutex_free(&sync_thread_mutex); } /*********************************************************************** |