aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/grpc++/completion_queue.h2
-rw-r--r--src/cpp/common/completion_queue.cc20
-rw-r--r--src/cpp/server/server_context.cc2
3 files changed, 10 insertions, 14 deletions
diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h
index 0bfbd5db7c..0075482d71 100644
--- a/include/grpc++/completion_queue.h
+++ b/include/grpc++/completion_queue.h
@@ -114,7 +114,7 @@ class CompletionQueue {
bool Pluck(CompletionQueueTag *tag);
// Does a single polling pluck on tag
- void TryPluck(CompletionQueueTag *tag, bool forever);
+ void TryPluck(CompletionQueueTag *tag);
grpc_completion_queue *cq_; // owned
};
diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc
index 5d186e06cc..414966c1cd 100644
--- a/src/cpp/common/completion_queue.cc
+++ b/src/cpp/common/completion_queue.cc
@@ -77,22 +77,18 @@ bool CompletionQueue::Next(void** tag, bool* ok) {
bool CompletionQueue::Pluck(CompletionQueueTag* tag) {
std::unique_ptr<grpc_event, EventDeleter> ev;
- for (;;) {
- ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_future));
- bool ok = ev->data.op_complete == GRPC_OP_OK;
- void* ignored = tag;
- if (tag->FinalizeResult(&ignored, &ok)) {
- GPR_ASSERT(ignored == tag);
- return ok;
- }
- }
+ ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_future));
+ bool ok = ev->data.op_complete == GRPC_OP_OK;
+ void* ignored = tag;
+ GPR_ASSERT(tag->FinalizeResult(&ignored, &ok));
+ GPR_ASSERT(ignored == tag);
+ return ok;
}
-void CompletionQueue::TryPluck(CompletionQueueTag* tag, bool forever) {
+void CompletionQueue::TryPluck(CompletionQueueTag* tag) {
std::unique_ptr<grpc_event, EventDeleter> ev;
- ev.reset(grpc_completion_queue_pluck(
- cq_, tag, forever ? gpr_inf_future : gpr_inf_past));
+ ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_past));
if (!ev) return;
bool ok = ev->data.op_complete == GRPC_OP_OK;
void* ignored = tag;
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc
index 92775c9492..1aa18bcac5 100644
--- a/src/cpp/server/server_context.cc
+++ b/src/cpp/server/server_context.cc
@@ -71,7 +71,7 @@ void ServerContext::CompletionOp::Unref() {
}
bool ServerContext::CompletionOp::CheckCancelled(CompletionQueue* cq) {
- cq->TryPluck(this, false);
+ cq->TryPluck(this);
std::lock_guard<std::mutex> g(mu_);
return finalized_ ? cancelled_ : false;
}