remove 'else' code, release lock by destructor

pull/1043/head
Ruyi Wang 10 years ago
parent 42a2e6f1b7
commit b486ba6b0d
  1. 12
      src/cpp/server/server.cc

@ -179,12 +179,12 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned)
thread_pool_owned_(thread_pool_owned) {}
Server::~Server() {
std::unique_lock<std::mutex> lock(mu_);
if (started_ && !shutdown_) {
lock.unlock();
Shutdown();
} else {
lock.unlock();
{
std::unique_lock<std::mutex> lock(mu_);
if (started_ && !shutdown_) {
lock.unlock();
Shutdown();
}
}
grpc_server_destroy(server_);
if (thread_pool_owned_) {

Loading…
Cancel
Save