Skip to content
Snippets Groups Projects
Commit 090c867e authored by Vijay Pai's avatar Vijay Pai
Browse files

This testing exposed a race condition in alarm creation - the

alarm needs to "begin" at the CQ before the timer should be inited.
parent 761bcb4a
No related branches found
No related tags found
No related merge requests found
...@@ -63,9 +63,9 @@ grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, gpr_timespec deadline, ...@@ -63,9 +63,9 @@ grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, gpr_timespec deadline,
alarm->cq = cq; alarm->cq = cq;
alarm->tag = tag; alarm->tag = tag;
grpc_cq_begin_op(cq, tag);
grpc_timer_init(&exec_ctx, &alarm->alarm, deadline, alarm_cb, alarm, grpc_timer_init(&exec_ctx, &alarm->alarm, deadline, alarm_cb, alarm,
gpr_now(GPR_CLOCK_MONOTONIC)); gpr_now(GPR_CLOCK_MONOTONIC));
grpc_cq_begin_op(cq, tag);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
return alarm; return alarm;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment