aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/iomgr/timer.c')
-rw-r--r--src/core/lib/iomgr/timer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/timer.c b/src/core/lib/iomgr/timer.c
index 99a66ee042..b46c6df287 100644
--- a/src/core/lib/iomgr/timer.c
+++ b/src/core/lib/iomgr/timer.c
@@ -239,6 +239,11 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
}
void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) {
+ if (!g_initialized) {
+ /* must have already been cancelled, also the shard mutex is invalid */
+ return;
+ }
+
shard_type *shard = &g_shards[shard_idx(timer)];
gpr_mu_lock(&shard->mu);
if (!timer->triggered) {