aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-07-15 08:54:50 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-07-15 08:54:50 -0700
commitd60b91dde0ad9593e23f134e261a2c58d0b3e331 (patch)
treec2178b96012d8a9369a66ca8b63bc7012db2c875 /src/cpp
parent6f6f59ae4b480d809d3e7f8af2b1a0cc3801117b (diff)
parentb955636d412b1734968519cfd561d09cf6a1bd53 (diff)
Merge remote-tracking branch 'upstream/master' into filter_call_init_failure
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/server/server.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index fb4c68ebe4..af04fd4ca6 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -281,6 +281,7 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
: max_message_size_(max_message_size),
started_(false),
shutdown_(false),
+ shutdown_notified_(false),
num_running_cb_(0),
sync_methods_(new std::list<SyncRequest>),
has_generic_service_(false),
@@ -462,13 +463,16 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
while (num_running_cb_ != 0) {
callback_cv_.wait(lock);
}
+
+ shutdown_notified_ = true;
+ shutdown_cv_.notify_all();
}
}
void Server::Wait() {
grpc::unique_lock<grpc::mutex> lock(mu_);
- while (num_running_cb_ != 0) {
- callback_cv_.wait(lock);
+ while (started_ && !shutdown_notified_) {
+ shutdown_cv_.wait(lock);
}
}