aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/exec_ctx.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-20 13:04:30 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-20 13:04:30 -0800
commitd48981221542a5bd760b64e5af379adb0e846bba (patch)
tree92d900be2d8648136a5f0219c63ca00b556577fe /src/core/lib/iomgr/exec_ctx.cc
parent177039b2f89e73ad0d048da021f939f3a153c4e2 (diff)
changes for macos
Diffstat (limited to 'src/core/lib/iomgr/exec_ctx.cc')
-rw-r--r--src/core/lib/iomgr/exec_ctx.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc
index 8a4b489ebb..a5d65f3d2c 100644
--- a/src/core/lib/iomgr/exec_ctx.cc
+++ b/src/core/lib/iomgr/exec_ctx.cc
@@ -161,7 +161,9 @@ static grpc_closure_scheduler exec_ctx_scheduler = {&exec_ctx_scheduler_vtable};
grpc_closure_scheduler* grpc_schedule_on_exec_ctx = &exec_ctx_scheduler;
namespace grpc_core {
+#ifndef GPR_PTHREAD_TLS
thread_local ExecCtx* ExecCtx::exec_ctx_ = nullptr;
+#endif
bool ExecCtx::Flush() {
bool did_something = 0;
@@ -192,9 +194,16 @@ void ExecCtx::GlobalInit(void) {
}
// allows uniform treatment in conversion functions
time_atm_pair_store(&g_start_time[GPR_TIMESPAN], gpr_time_0(GPR_TIMESPAN));
+#ifdef GPR_PTHREAD_TLS
+ gpr_tls_init(&exec_ctx_);
+#endif
}
-void ExecCtx::GlobalShutdown(void) {}
+void ExecCtx::GlobalShutdown(void) {
+#ifdef GPR_PTHREAD_TLS
+ gpr_tls_destroy(&exec_ctx_);
+#endif
+}
grpc_millis ExecCtx::Now() {
if (!now_is_valid_) {