@@ -210,11 +210,7 @@ class ExecCtx {
210210 unsigned starting_cpu_ = std::numeric_limits<unsigned >::max();
211211
212212 ScopedTimeCache time_cache_;
213-
214- static ExecCtx** GetExecCtx () {
215- static thread_local ExecCtx* exec_ctx = nullptr ;
216- return &exec_ctx;
217- }
213+ static ExecCtx** GetExecCtx ();
218214
219215 ExecCtx* last_exec_ctx_ = Get();
220216};
@@ -286,7 +282,7 @@ class ApplicationCallbackExecCtx {
286282 }
287283 (*f->functor_run )(f, f->internal_success );
288284 }
289- callback_exec_ctx_ = nullptr ;
285+ * GetCallbackExecCtx () = nullptr ;
290286 if (!(GRPC_APP_CALLBACK_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
291287 Fork::DecExecCtxCount ();
292288 }
@@ -298,14 +294,14 @@ class ApplicationCallbackExecCtx {
298294
299295 uintptr_t Flags () { return flags_; }
300296
301- static ApplicationCallbackExecCtx* Get () { return callback_exec_ctx_ ; }
297+ static ApplicationCallbackExecCtx* Get () { return * GetCallbackExecCtx () ; }
302298
303299 static void Set (ApplicationCallbackExecCtx* exec_ctx, uintptr_t flags) {
304300 if (Get () == nullptr ) {
305301 if (!(GRPC_APP_CALLBACK_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags)) {
306302 Fork::IncExecCtxCount ();
307303 }
308- callback_exec_ctx_ = exec_ctx;
304+ * GetCallbackExecCtx () = exec_ctx;
309305 }
310306 }
311307
@@ -330,7 +326,8 @@ class ApplicationCallbackExecCtx {
330326 uintptr_t flags_{0u };
331327 grpc_completion_queue_functor* head_{nullptr };
332328 grpc_completion_queue_functor* tail_{nullptr };
333- static thread_local ApplicationCallbackExecCtx* callback_exec_ctx_;
329+
330+ static ApplicationCallbackExecCtx** GetCallbackExecCtx ();
334331};
335332
336333} // namespace grpc_core
0 commit comments