Properly init TLS for callback exec context

pull/17838/head
Vijay Pai 6 years ago
parent 5176fd80fc
commit 5b7f0532ac
  1. 6
      src/core/lib/iomgr/exec_ctx.h
  2. 2
      src/core/lib/surface/init.cc

@ -271,6 +271,12 @@ class ApplicationCallbackExecCtx {
ctx->tail_ = functor;
}
/** Global initialization for ApplicationCallbackExecCtx. Called by init. */
static void GlobalInit(void) { gpr_tls_init(&callback_exec_ctx_); }
/** Global shutdown for ApplicationCallbackExecCtx. Called by init. */
static void GlobalShutdown(void) { gpr_tls_destroy(&callback_exec_ctx_); }
private:
grpc_experimental_completion_queue_functor* head_{nullptr};
grpc_experimental_completion_queue_functor* tail_{nullptr};

@ -130,6 +130,7 @@ void grpc_init(void) {
grpc_channel_init_init();
grpc_core::channelz::ChannelzRegistry::Init();
grpc_security_pre_init();
grpc_core::ApplicationCallbackExecCtx::GlobalInit();
grpc_core::ExecCtx::GlobalInit();
grpc_iomgr_init();
gpr_timers_global_init();
@ -183,6 +184,7 @@ void grpc_shutdown(void) {
grpc_core::Fork::GlobalShutdown();
}
grpc_core::ExecCtx::GlobalShutdown();
grpc_core::ApplicationCallbackExecCtx::GlobalShutdown();
}
gpr_mu_unlock(&g_init_mu);
}

Loading…
Cancel
Save