aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/server_async.cc
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-10-17 14:31:44 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-10-17 14:31:44 -0700
commit654b242ce70afcf9fdab674cab9b71d8d3f02502 (patch)
treef463f15f28a23c0b94cd2c1e2a3250a416943ad1 /test/cpp/qps/server_async.cc
parenta628c84e86c0a545c7550e865a356ca4144047f8 (diff)
parent14c836fcd10e4f96ae1f4ac22fe43d42e2e293ba (diff)
Merge branch 'direct-calls' into buffer_pools_for_realsies
Diffstat (limited to 'test/cpp/qps/server_async.cc')
-rw-r--r--test/cpp/qps/server_async.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 1163b765e3..3d2ac78868 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -137,9 +137,7 @@ class AsyncQpsServerTest : public Server {
std::lock_guard<std::mutex> lock((*ss)->mutex);
(*ss)->shutdown = true;
}
- // TODO (vpai): Remove this deadline and allow Shutdown to finish properly
- auto deadline = std::chrono::system_clock::now() + std::chrono::seconds(3);
- server_->Shutdown(deadline);
+ std::thread shutdown_thread(&AsyncQpsServerTest::ShutdownThreadFunc, this);
for (auto cq = srv_cqs_.begin(); cq != srv_cqs_.end(); ++cq) {
(*cq)->Shutdown();
}
@@ -152,9 +150,16 @@ class AsyncQpsServerTest : public Server {
while ((*cq)->Next(&got_tag, &ok))
;
}
+ shutdown_thread.join();
}
private:
+ void ShutdownThreadFunc() {
+ // TODO (vpai): Remove this deadline and allow Shutdown to finish properly
+ auto deadline = std::chrono::system_clock::now() + std::chrono::seconds(3);
+ server_->Shutdown(deadline);
+ }
+
void ThreadFunc(int thread_idx) {
// Wait until work is available or we are shutting down
bool ok;