diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-11-27 15:58:44 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-11-27 15:58:44 -0800 |
commit | 3285f4c7329bf4305133be74f88dd4b10d5e2052 (patch) | |
tree | 936ee957e2eaaa4ed16ac0e16feae6fdacf45499 | |
parent | 45b7ad5cf51ad97314d769ed70cfcda53d41b9d1 (diff) |
Fix grpc_init by removing exec_ctx usage before init
-rw-r--r-- | include/grpc/support/tls_gcc.h | 6 | ||||
-rw-r--r-- | src/core/lib/iomgr/iomgr.cc | 7 | ||||
-rw-r--r-- | src/core/lib/surface/init.cc | 1 |
3 files changed, 8 insertions, 6 deletions
diff --git a/include/grpc/support/tls_gcc.h b/include/grpc/support/tls_gcc.h index 136cb75dac..e0ef6b2789 100644 --- a/include/grpc/support/tls_gcc.h +++ b/include/grpc/support/tls_gcc.h @@ -40,12 +40,12 @@ struct gpr_gcc_thread_local { /** Use GPR_TLS_CLASS_DECL to declare tls static variable members of a class. * GPR_TLS_CLASS_DEF needs to be called to define this member. */ -#define GPR_TLS_CLASS_DECL(name) \ - static bool name##_inited; \ +#define GPR_TLS_CLASS_DECL(name) \ + static bool name##_inited; \ static __thread struct gpr_gcc_thread_local name #define GPR_TLS_CLASS_DEF(name) \ - bool name##_inited = false; \ + bool name##_inited = false; \ __thread struct gpr_gcc_thread_local name = {0, &(name##_inited)} #define gpr_tls_init(tls) \ diff --git a/src/core/lib/iomgr/iomgr.cc b/src/core/lib/iomgr/iomgr.cc index f3f080e315..3bad17a54e 100644 --- a/src/core/lib/iomgr/iomgr.cc +++ b/src/core/lib/iomgr/iomgr.cc @@ -50,8 +50,11 @@ void grpc_iomgr_init() { gpr_mu_init(&g_mu); gpr_cv_init(&g_rcv); grpc_core::ExecCtx::GlobalInit(); - grpc_executor_init(); - grpc_timer_list_init(); + { + grpc_core::ExecCtx _local_exec_ctx; + grpc_executor_init(); + grpc_timer_list_init(); + } g_root_object.next = g_root_object.prev = &g_root_object; g_root_object.name = (char*)"root"; grpc_network_status_init(); diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index cdbe01e1d4..da641e1cf5 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -116,7 +116,6 @@ void grpc_init(void) { int i; gpr_once_init(&g_basic_init, do_basic_init); - grpc_core::ExecCtx _local_exec_ctx; gpr_mu_lock(&g_init_mu); if (++g_initializations == 1) { gpr_time_init(); |