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
No related merge requests found
......@@ -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_) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment