aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/lib/surface/completion_queue.c14
-rw-r--r--test/cpp/qps/client.h4
-rw-r--r--test/cpp/qps/client_async.cc4
-rw-r--r--test/cpp/qps/server.h4
-rw-r--r--test/cpp/qps/server_async.cc4
5 files changed, 17 insertions, 13 deletions
diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c
index 346ea18d5a..e48d2f8f46 100644
--- a/src/core/lib/surface/completion_queue.c
+++ b/src/core/lib/surface/completion_queue.c
@@ -227,7 +227,7 @@ struct grpc_completion_queue {
/* TODO: sreek - This will no longer be needed. Use polling_type set */
int is_non_listening_server_cq;
int num_pluckers;
- gpr_atm num_polls;
+ int num_polls;
plucker pluckers[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS];
grpc_closure pollset_shutdown_done;
@@ -293,7 +293,7 @@ grpc_completion_queue *grpc_completion_queue_create_internal(
cc->is_server_cq = 0;
cc->is_non_listening_server_cq = 0;
cc->num_pluckers = 0;
- gpr_atm_no_barrier_store(&cc->num_polls, 0);
+ cc->num_polls = 0;
gpr_atm_no_barrier_store(&cc->things_queued_ever, 0);
#ifndef NDEBUG
cc->outstanding_tag_count = 0;
@@ -311,7 +311,11 @@ grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc) {
}
gpr_atm grpc_get_cq_poll_num(grpc_completion_queue *cc) {
- return gpr_atm_no_barrier_load(&cc->num_polls);
+ int cur_num_polls;
+ gpr_mu_lock(cc->mu);
+ cur_num_polls = cc->num_polls;
+ gpr_mu_unlock(cc->mu);
+ return cur_num_polls;
}
#ifdef GRPC_CQ_REF_COUNT_DEBUG
@@ -598,7 +602,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
gpr_mu_lock(cc->mu);
continue;
} else {
- gpr_atm_no_barrier_fetch_add(&cc->num_polls, 1);
+ cc->num_polls++;
grpc_error *err = cc->poller_vtable->work(&exec_ctx, POLLSET_FROM_CQ(cc),
NULL, now, iteration_deadline);
if (err != GRPC_ERROR_NONE) {
@@ -791,7 +795,7 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
grpc_exec_ctx_flush(&exec_ctx);
gpr_mu_lock(cc->mu);
} else {
- gpr_atm_no_barrier_fetch_add(&cc->num_polls, 1);
+ cc->num_polls++;
grpc_error *err = cc->poller_vtable->work(
&exec_ctx, POLLSET_FROM_CQ(cc), &worker, now, iteration_deadline);
if (err != GRPC_ERROR_NONE) {
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 8006cacedd..c8a60bce50 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -54,6 +54,10 @@
#include "test/cpp/qps/usage_timer.h"
#include "test/cpp/util/create_test_channel.h"
+extern "C" {
+#include "src/core/lib/surface/completion_queue.h"
+}
+
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 63da1e719d..d9cda9fb07 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -54,10 +54,6 @@
#include "test/cpp/qps/usage_timer.h"
#include "test/cpp/util/create_test_channel.h"
-extern "C" {
-#include "src/core/lib/surface/completion_queue.h"
-}
-
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index d75f379576..007770421a 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -44,6 +44,10 @@
#include "test/core/util/port.h"
#include "test/cpp/qps/usage_timer.h"
+extern "C" {
+#include "src/core/lib/surface/completion_queue.h"
+}
+
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 57f45d325f..4f0b1f54d7 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -53,10 +53,6 @@
#include "test/core/util/test_config.h"
#include "test/cpp/qps/server.h"
-extern "C" {
-#include "src/core/lib/surface/completion_queue.h"
-}
-
namespace grpc {
namespace testing {