aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreecha@users.noreply.github.com>2017-08-04 13:16:13 -0700
committerGravatar GitHub <noreply@github.com>2017-08-04 13:16:13 -0700
commit1fb3b669f957c02b32ce0b967f391493b81808f5 (patch)
treed1b4cb285bd4dd47a87e53112e47adad11e353bf /test
parent18df25228cfa1f97fc5cca9176fbaef64c0e4221 (diff)
parent34989fdaae7cf5d214529a49563ea11fc8860a87 (diff)
Merge pull request #11579 from sreecha/fix_alarm
Refcount grpc_alarm object so that grpc_alarm_destroy() can be safely called before cq-next()
Diffstat (limited to 'test')
-rw-r--r--test/core/surface/alarm_test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c
index baaa05928e..6971d92074 100644
--- a/test/core/surface/alarm_test.c
+++ b/test/core/surface/alarm_test.c
@@ -73,6 +73,21 @@ static void test_alarm(void) {
GPR_ASSERT(ev.success == 0);
grpc_alarm_destroy(alarm);
}
+ {
+ /* alarm_destroy before cq_next */
+ grpc_event ev;
+ void *tag = create_test_tag();
+ grpc_alarm *alarm =
+ grpc_alarm_create(cc, grpc_timeout_seconds_to_deadline(2), tag);
+
+ grpc_alarm_destroy(alarm);
+ ev = grpc_completion_queue_next(cc, grpc_timeout_seconds_to_deadline(1),
+ NULL);
+ GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
+ GPR_ASSERT(ev.tag == tag);
+ GPR_ASSERT(ev.success == 0);
+ }
+
shutdown_and_destroy(cc);
}