From 94a85b051d9848e8e2a1506cc80396a046cc122c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 31 Jul 2020 14:26:17 -0700 Subject: [PATCH] Expand comment to address reviewer feedback --- test/cpp/microbenchmarks/bm_cq.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 1640c4d52f0..8ab0450f4ee 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -211,7 +211,12 @@ static void BM_Callback_CQ_Pass1Core(benchmark::State& state) { bool got_shutdown = false; ShutdownCallback shutdown_cb(&got_shutdown); // This test with stack-allocated completions only works for non-polling or - // EM-polling callback core CQs. For generality, test with non-polling. + // EM-polling callback core CQs because otherwise the callback could execute + // on another thread after the stack objects here go out of scope. An + // alternative would be to synchronize between the benchmark loop and the + // callback, but then it would be measuring the overhead of synchronization + // rather than the overhead of the completion queue. + // For generality, test here with non-polling. grpc_completion_queue_attributes attr; attr.version = 2; attr.cq_completion_type = GRPC_CQ_CALLBACK;