From 3d769d7f23b11f2282ec10a309c6d36f0a8907cd Mon Sep 17 00:00:00 2001
From: yang-g <yangg@google.com>
Date: Thu, 30 Jul 2015 09:57:12 -0700
Subject: [PATCH] notify inside lock

---
 test/cpp/interop/reconnect_interop_server.cc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc
index f7e1e8bd30..1c9ba55fb8 100644
--- a/test/cpp/interop/reconnect_interop_server.cc
+++ b/test/cpp/interop/reconnect_interop_server.cc
@@ -116,8 +116,8 @@ class ReconnectServiceImpl : public ReconnectService::Service {
     {
       std::lock_guard<std::mutex> lock(mu_);
       serving_ = false;
+      cv_.notify_one();
     }
-    cv_.notify_one();
     return Status::OK;
   }
 
@@ -147,10 +147,8 @@ class ReconnectServiceImpl : public ReconnectService::Service {
   }
 
   void Shutdown() {
-    {
-      std::lock_guard<std::mutex> lock(mu_);
-      shutdown_ = true;
-    }
+    std::lock_guard<std::mutex> lock(mu_);
+    shutdown_ = true;
     cv_.notify_all();
   }
 
-- 
GitLab