C++ code changes in response to grpc_completion_queue_create() API change
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index 89ed924..542f396 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -354,8 +354,9 @@
}
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
const string expected_token =
- strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix +
- std::to_string(sf->port);
+ strlen(sf->lb_token_prefix) == 0
+ ? ""
+ : sf->lb_token_prefix + std::to_string(sf->port);
GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token",
expected_token.c_str()));
@@ -593,7 +594,7 @@
grpc_channel_args_copy_and_add(NULL, &expected_target_arg, 1);
gpr_free(expected_target_names);
- cf->cq = grpc_completion_queue_create(NULL);
+ cf->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL);
cf->server_uri = lb_uri;
grpc_channel_credentials *fake_creds =
grpc_fake_transport_security_credentials_create();
@@ -616,7 +617,7 @@
static void setup_server(const char *host, server_fixture *sf) {
int assigned_port;
- sf->cq = grpc_completion_queue_create(NULL);
+ sf->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL);
const char *colon_idx = strchr(host, ':');
if (colon_idx) {
const char *port_str = colon_idx + 1;
@@ -643,10 +644,15 @@
if (!sf->server) return;
gpr_log(GPR_INFO, "Server[%s] shutting down", sf->servers_hostport);
- grpc_server_shutdown_and_notify(sf->server, sf->cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(
- sf->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL)
+
+ grpc_completion_queue *shutdown_cq =
+ grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL);
+ grpc_server_shutdown_and_notify(sf->server, shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
+ grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(sf->server);
gpr_thd_join(sf->tid);
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index 76d5030..ecfa20a 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -65,7 +65,8 @@
static void BM_InsecureChannelWithDefaults(benchmark::State &state) {
grpc_channel *channel =
grpc_insecure_channel_create("localhost:12345", NULL, NULL);
- grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
+ grpc_completion_queue *cq =
+ grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, NULL);
grpc_slice method = grpc_slice_from_static_string("/foo/bar");
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
while (state.KeepRunning()) {
diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc
index c017474..c7bd874 100644
--- a/test/cpp/microbenchmarks/bm_cq.cc
+++ b/test/cpp/microbenchmarks/bm_cq.cc
@@ -66,7 +66,10 @@
static void BM_CreateDestroyCore(benchmark::State& state) {
while (state.KeepRunning()) {
- grpc_completion_queue_destroy(grpc_completion_queue_create(NULL));
+ // TODO: sreek Make this a templatized benchmark and pass completion type
+ // and polling type as parameters
+ grpc_completion_queue_destroy(
+ grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL));
}
}
BENCHMARK(BM_CreateDestroyCore);
@@ -98,7 +101,10 @@
BENCHMARK(BM_Pass1Cpp);
static void BM_Pass1Core(benchmark::State& state) {
- grpc_completion_queue* cq = grpc_completion_queue_create(NULL);
+ // TODO: sreek Make this templatized benchmark and pass polling_type as a
+ // param
+ grpc_completion_queue* cq =
+ grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL);
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
while (state.KeepRunning()) {
grpc_cq_completion completion;
@@ -114,7 +120,10 @@
BENCHMARK(BM_Pass1Core);
static void BM_Pluck1Core(benchmark::State& state) {
- grpc_completion_queue* cq = grpc_completion_queue_create(NULL);
+ // TODO: sreek Make this templatized benchmark and pass polling_type as a
+ // param
+ grpc_completion_queue* cq =
+ grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, NULL);
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
while (state.KeepRunning()) {
grpc_cq_completion completion;
@@ -130,7 +139,10 @@
BENCHMARK(BM_Pluck1Core);
static void BM_EmptyCore(benchmark::State& state) {
- grpc_completion_queue* cq = grpc_completion_queue_create(NULL);
+ // TODO: sreek Make this a templatized benchmark and pass polling_type as a
+ // param
+ grpc_completion_queue* cq =
+ grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL);
gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC);
while (state.KeepRunning()) {
grpc_completion_queue_next(cq, deadline, NULL);