[shutdown] Add logs when shutdown is done

pull/36002/head
Yash Tibrewal 11 months ago
parent 641213ee58
commit 61b9ad573a
  1. 8
      src/core/lib/surface/init.cc

@ -136,8 +136,8 @@ void grpc_shutdown_internal_locked(void)
g_shutting_down_cv->SignalAll();
}
void grpc_shutdown_internal(void* /*ignored*/) {
GRPC_API_TRACE("grpc_shutdown_internal", 0, ());
void grpc_shutdown_from_cleanup_thread(void* /*ignored*/) {
GRPC_API_TRACE("grpc_shutdown_from_cleanup_thread", 0, ());
grpc_core::MutexLock lock(g_init_mu);
// We have released lock from the shutdown thread and it is possible that
// another grpc_init has been called, and do nothing if that is the case.
@ -145,6 +145,7 @@ void grpc_shutdown_internal(void* /*ignored*/) {
return;
}
grpc_shutdown_internal_locked();
gpr_log(GPR_DEBUG, "grpc_shutdown from cleanup thread done");
}
void grpc_shutdown(void) {
@ -165,6 +166,7 @@ void grpc_shutdown(void) {
gpr_log(GPR_DEBUG, "grpc_shutdown starts clean-up now");
g_shutting_down = true;
grpc_shutdown_internal_locked();
gpr_log(GPR_DEBUG, "grpc_shutdown done");
} else {
// spawn a detached thread to do the actual clean up in case we are
// currently in an executor thread.
@ -172,7 +174,7 @@ void grpc_shutdown(void) {
g_initializations++;
g_shutting_down = true;
grpc_core::Thread cleanup_thread(
"grpc_shutdown", grpc_shutdown_internal, nullptr, nullptr,
"grpc_shutdown", grpc_shutdown_from_cleanup_thread, nullptr, nullptr,
grpc_core::Thread::Options().set_joinable(false).set_tracked(false));
cleanup_thread.Start();
}

Loading…
Cancel
Save