aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/alarm.c
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2016-02-11 14:43:43 -0800
committerGravatar Vijay Pai <vpai@google.com>2016-02-11 14:43:43 -0800
commit090c867e28c6898b5e5fe32d8fe5ef5178986721 (patch)
tree437c598b10db941b4ff306576b79dfc96bb8b4b9 /src/core/surface/alarm.c
parent761bcb4a18c7a59dfabe2276f615945f59e5021f (diff)
This testing exposed a race condition in alarm creation - the
alarm needs to "begin" at the CQ before the timer should be inited.
Diffstat (limited to 'src/core/surface/alarm.c')
-rw-r--r--src/core/surface/alarm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/surface/alarm.c b/src/core/surface/alarm.c
index d753023ca9..fb496f6c47 100644
--- a/src/core/surface/alarm.c
+++ b/src/core/surface/alarm.c
@@ -63,9 +63,9 @@ grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, gpr_timespec deadline,
alarm->cq = cq;
alarm->tag = tag;
+ grpc_cq_begin_op(cq, tag);
grpc_timer_init(&exec_ctx, &alarm->alarm, deadline, alarm_cb, alarm,
gpr_now(GPR_CLOCK_MONOTONIC));
- grpc_cq_begin_op(cq, tag);
grpc_exec_ctx_finish(&exec_ctx);
return alarm;
}