Merge pull request #1043 from icodeplus/remove_else_code

remove 'else' code, release lock by destructor
pull/1048/head
Yang Gao 10 years ago
commit 4c3ee74d4e
  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