diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-05-31 03:12:03 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-05-31 03:12:03 +0300 |
commit | 3cba21f9f5abdaea110f40155467cab2899b5461 (patch) | |
tree | 028daf6927cddff18af2ae4c5bbc03a329c59dec /innobase/srv | |
parent | 5d1171c024089093d6274dd9d18b480c93516109 (diff) | |
download | mariadb-git-3cba21f9f5abdaea110f40155467cab2899b5461.tar.gz |
Many files:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/os/os0sync.c:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/os/os0thread.c:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/include/os0sync.h:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/include/srv0srv.h:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/include/srv0start.h:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/ibuf/ibuf0ibuf.c:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/srv/srv0srv.c:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/srv/srv0start.c:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/sync/sync0sync.c:
Free all OS sync primitives and allocated memory in InnoDB shutdown
innobase/ut/ut0mem.c:
Free all OS sync primitives and allocated memory in InnoDB shutdown
Diffstat (limited to 'innobase/srv')
-rw-r--r-- | innobase/srv/srv0srv.c | 69 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 32 |
2 files changed, 27 insertions, 74 deletions
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index a44bc0147e4..da2966a7124 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1693,80 +1693,33 @@ srv_init(void) ut_a(conc_slot->event); } } - + /************************************************************************* -Initializes the synchronization primitives, memory system, and the thread -local storage. */ +Frees the OS fast mutex created in srv_init(). */ void -srv_general_init(void) -/*==================*/ +srv_free(void) +/*==========*/ { - os_thread_count_mutex = os_mutex_create(NULL); - - sync_init(); - mem_init(srv_mem_pool_size); - thr_local_init(); + os_fast_mutex_free(&srv_conc_mutex); } - -#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY) -/* NetWare requires some cleanup of mutexes */ - /************************************************************************* -Deinitializes the synchronization primitives, memory system, and the thread +Initializes the synchronization primitives, memory system, and the thread local storage. */ void -srv_general_free(void) +srv_general_init(void) /*==================*/ { - sync_close(); - - os_mutex_free(os_thread_count_mutex); + os_sync_init(); + sync_init(); + mem_init(srv_mem_pool_size); + thr_local_init(); } -#endif /* __NETWARE__ */ - /*======================= InnoDB Server FIFO queue =======================*/ -#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY) -/* NetWare requires some cleanup of mutexes */ - -/************************************************************************* -Deinitializes the server. */ - -void -srv_free(void) -/*==========*/ -{ - srv_conc_slot_t* conc_slot; - srv_slot_t* slot; - ulint i; - - for (i = 0; i < OS_THREAD_MAX_N; i++) - { - slot = srv_table_get_nth_slot(i); - os_event_free(slot->event); - } - - /* TODO: free(srv_sys->threads); */ - - for (i = 0; i < OS_THREAD_MAX_N; i++) - { - slot = srv_mysql_table + i; - os_event_free(slot->event); - } - - /* TODO: free(srv_mysql_table); */ - - for (i = 0; i < OS_THREAD_MAX_N; i++) - { - conc_slot = srv_conc_slots + i; - os_event_free(conc_slot->event); - } -} -#endif /* __NETWARE__ */ /************************************************************************* Puts an OS thread to wait if there are too many concurrent threads diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index d34c18b1a25..f03355b825c 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1442,9 +1442,7 @@ innobase_start_or_create_for_mysql(void) os_fast_mutex_unlock(&srv_os_test_mutex); -#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY) - os_fast_mutex_free(&srv_os_test_mutex); /* all platforms? */ -#endif /* __NETWARE__ */ + os_fast_mutex_free(&srv_os_test_mutex); if (srv_print_verbose_log) { ut_print_timestamp(stderr); @@ -1484,7 +1482,7 @@ innobase_shutdown_for_mysql(void) return(DB_SUCCESS); } - /* Flush buffer pool to disk, write the current lsn to + /* 1. Flush buffer pool to disk, write the current lsn to the tablespace header(s), and copy all log data to archive */ logs_empty_and_mark_files_at_shutdown(); @@ -1496,7 +1494,7 @@ innobase_shutdown_for_mysql(void) srv_conc_n_threads); } - /* Now we will exit all threads InnoDB created */ + /* 2. Make all threads created by InnoDB to exit */ srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS; @@ -1521,7 +1519,7 @@ innobase_shutdown_for_mysql(void) os_aio_wake_all_threads_at_shutdown(); - os_mutex_enter(os_thread_count_mutex); + os_mutex_enter(os_sync_mutex); if (os_thread_count == 0) { /* All the threads have exited or are just exiting; @@ -1530,14 +1528,14 @@ innobase_shutdown_for_mysql(void) they have exited? Now we just sleep 0.1 seconds and hope that is enough! */ - os_mutex_exit(os_thread_count_mutex); + os_mutex_exit(os_sync_mutex); os_thread_sleep(100000); break; } - os_mutex_exit(os_thread_count_mutex); + os_mutex_exit(os_sync_mutex); os_thread_sleep(100000); } @@ -1548,19 +1546,21 @@ innobase_shutdown_for_mysql(void) os_thread_count); } -#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY) + /* 3. Free all InnoDB's own mutexes */ + + sync_close(); + + /* 4. Free all OS synchronization primitives (in Windows currently + events are not freed) */ - /* TODO: Where should this be called? */ srv_free(); + os_sync_free(); - /* TODO: Where should this be called? */ - srv_general_free(); -#endif + /* 5. Free all allocated memory (and the os_fast_mutex created in + ut0mem.c */ -#if defined(NOT_WORKING_YET) || defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY) - /* NetWare requires this free */ ut_free_all_mem(); -#endif + if (srv_print_verbose_log) { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Shutdown completed\n"); |