summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-06-29 11:31:01 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-06-29 22:20:34 +0300
commitbb60a832ede139d24a2470a1b1217d30799d726e (patch)
treeafc89534b3743fb17b9027a922d55a605d0d0720
parentde3201df3fc830e4dc2ddc181a57d54e172ea3f4 (diff)
downloadmariadb-git-bb60a832ede139d24a2470a1b1217d30799d726e.tar.gz
Minor cleanup of InnoDB shutdown
os_thread_active(): Remove. srv_shutdown_all_bg_threads(): Assert that high-level threads have already exited. Do not sleep if os_thread_count=0.
-rw-r--r--storage/innobase/include/os0thread.h6
-rw-r--r--storage/innobase/os/os0thread.cc18
-rw-r--r--storage/innobase/srv/srv0start.cc15
3 files changed, 4 insertions, 35 deletions
diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h
index 071e7422894..d4430f5ebce 100644
--- a/storage/innobase/include/os0thread.h
+++ b/storage/innobase/include/os0thread.h
@@ -151,10 +151,4 @@ os_thread_sleep(
/*============*/
ulint tm); /*!< in: time in microseconds */
-/*****************************************************************//**
-Check if there are threads active.
-@return true if the thread count > 0. */
-bool
-os_thread_active();
-
#endif
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index 0462c62f4b2..fde743a9074 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -237,21 +237,3 @@ os_thread_sleep(
select(0, NULL, NULL, NULL, &t);
#endif /* _WIN32 */
}
-
-/*****************************************************************//**
-Check if there are threads active.
-@return true if the thread count > 0. */
-bool
-os_thread_active()
-/*==============*/
-{
- /* All the threads have exited or are just exiting;
- NOTE that the threads may not have completed their
- exit yet. Should we use pthread_join() to make sure
- they have exited? If we did, we would have to
- remove the pthread_detach() from
- os_thread_exit(). Now we just sleep 0.1
- seconds and hope that is enough! */
-
- return(my_atomic_loadlint(&os_thread_count) > 0);
-}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index e625ab84334..dfdea96d85d 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1234,6 +1234,7 @@ static
void
srv_shutdown_all_bg_threads()
{
+ ut_ad(!srv_undo_sources);
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;
/* All threads end up waiting for certain events. Put those events
@@ -1285,13 +1286,7 @@ srv_shutdown_all_bg_threads()
os_event_set(buf_flush_event);
- /* f. dict_stats_thread is signaled from
- logs_empty_and_mark_files_at_shutdown() and
- should have already quit or is quitting right
- now. */
-
if (srv_use_mtflush) {
- /* g. Exit the multi threaded flush threads */
buf_mtflu_io_thread_exit();
}
}
@@ -1300,13 +1295,11 @@ srv_shutdown_all_bg_threads()
os_aio_wake_all_threads_at_shutdown();
}
- const bool active = os_thread_active();
-
- os_thread_sleep(100000);
-
- if (!active) {
+ if (!os_thread_count) {
return;
}
+
+ os_thread_sleep(100000);
}
ib::warn() << os_thread_count << " threads created by InnoDB"