Dont sleep forever on async cq

pull/1240/head
Craig Tiller 10 years ago
parent 8a5a666ad0
commit 1c61af7364
  1. 12
      test/cpp/qps/client_async.cc

@ -176,7 +176,11 @@ class AsyncUnaryClient GRPC_FINAL : public Client {
bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE {
void* got_tag; void* got_tag;
bool ok; bool ok;
cli_cqs_[thread_idx]->Next(&got_tag, &ok); switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) {
case CompletionQueue::SHUTDOWN: return false;
case CompletionQueue::TIMEOUT: return true;
case CompletionQueue::GOT_EVENT: break;
}
ClientRpcContext* ctx = ClientRpcContext::detag(got_tag); ClientRpcContext* ctx = ClientRpcContext::detag(got_tag);
if (ctx->RunNextState(ok, histogram) == false) { if (ctx->RunNextState(ok, histogram) == false) {
@ -306,7 +310,11 @@ class AsyncStreamingClient GRPC_FINAL : public Client {
bool ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { bool ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE {
void *got_tag; void *got_tag;
bool ok; bool ok;
cli_cqs_[thread_idx]->Next(&got_tag, &ok); switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) {
case CompletionQueue::SHUTDOWN: return false;
case CompletionQueue::TIMEOUT: return true;
case CompletionQueue::GOT_EVENT: break;
}
ClientRpcContext *ctx = ClientRpcContext::detag(got_tag); ClientRpcContext *ctx = ClientRpcContext::detag(got_tag);
if (ctx->RunNextState(ok, histogram) == false) { if (ctx->RunNextState(ok, histogram) == false) {

Loading…
Cancel
Save