aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-04-19 22:07:51 +0000
committerGravatar Craig Tiller <ctiller@google.com>2017-04-19 22:07:51 +0000
commit9247817082bc5d33ebe048a1aa0c5881fdb408ed (patch)
treeb3d38b4ba2b7df6a754c52ce1ace7ae96e4e36f0 /test/cpp
parent2b465f00e94f8b5073ab913e7110c51a0ffbc62b (diff)
parentfeaee850bf82251f3797749f9b2ef4580b1ba002 (diff)
Merge github.com:grpc/grpc into trickle_stall
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/qps/client_sync.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index a020adde51..f8ce2cccbe 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -153,16 +153,22 @@ class SynchronousStreamingClient final : public SynchronousClient {
StartThreads(num_threads_);
}
~SynchronousStreamingClient() {
+ std::vector<std::thread> cleanup_threads;
for (size_t i = 0; i < num_threads_; i++) {
- auto stream = &stream_[i];
- if (*stream) {
- (*stream)->WritesDone();
- Status s = (*stream)->Finish();
- if (!s.ok()) {
- gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", i,
- s.error_message().c_str());
+ cleanup_threads.emplace_back([this, i]() {
+ auto stream = &stream_[i];
+ if (*stream) {
+ (*stream)->WritesDone();
+ Status s = (*stream)->Finish();
+ if (!s.ok()) {
+ gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", i,
+ s.error_message().c_str());
+ }
}
- }
+ });
+ }
+ for (size_t i = 0; i < num_threads_; i++) {
+ cleanup_threads[i].join();
}
}
@@ -179,6 +185,8 @@ class SynchronousStreamingClient final : public SynchronousClient {
if ((messages_per_stream_ != 0) &&
(++messages_issued_[thread_idx] < messages_per_stream_)) {
return true;
+ } else if (messages_per_stream_ == 0) {
+ return true;
} else {
// Fall through to the below resetting code after finish
}