Skip to content
Snippets Groups Projects
Commit b486ba6b authored by Ruyi Wang's avatar Ruyi Wang
Browse files

remove 'else' code, release lock by destructor

parent 42a2e6f1
No related branches found
No related tags found
Loading
...@@ -179,12 +179,12 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned) ...@@ -179,12 +179,12 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned)
thread_pool_owned_(thread_pool_owned) {} thread_pool_owned_(thread_pool_owned) {}
Server::~Server() { Server::~Server() {
std::unique_lock<std::mutex> lock(mu_); {
if (started_ && !shutdown_) { std::unique_lock<std::mutex> lock(mu_);
lock.unlock(); if (started_ && !shutdown_) {
Shutdown(); lock.unlock();
} else { Shutdown();
lock.unlock(); }
} }
grpc_server_destroy(server_); grpc_server_destroy(server_);
if (thread_pool_owned_) { if (thread_pool_owned_) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment