diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 19d353feec9..5830b8c9d44 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -64,20 +64,18 @@ extern void grpc_register_built_in_plugins(void); static gpr_once g_basic_init = GPR_ONCE_INIT; static grpc_core::Mutex* g_init_mu; -static int g_initializations; +static int g_initializations ABSL_GUARDED_BY(g_init_mu) = 0; static grpc_core::CondVar* g_shutting_down_cv; -static bool g_shutting_down; +static bool g_shutting_down ABSL_GUARDED_BY(g_init_mu) = false; static void do_basic_init(void) { gpr_log_verbosity_init(); g_init_mu = new grpc_core::Mutex(); g_shutting_down_cv = new grpc_core::CondVar(); - g_shutting_down = false; grpc_register_built_in_plugins(); grpc_cq_global_init(); grpc_core::grpc_executor_global_init(); gpr_time_init(); - g_initializations = 0; } static bool append_filter(grpc_channel_stack_builder* builder, void* arg) { @@ -167,7 +165,8 @@ void grpc_init(void) { GRPC_API_TRACE("grpc_init(void)", 0, ()); } -void grpc_shutdown_internal_locked(void) { +void grpc_shutdown_internal_locked(void) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(g_init_mu) { int i; { grpc_core::ExecCtx exec_ctx(0);