Commit bb60a832 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent de3201df
......@@ -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
......@@ -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);
}
......@@ -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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment