|
|
@ -510,12 +510,6 @@ void Server::ShutdownInternal(gpr_timespec deadline) { |
|
|
|
ShutdownTag shutdown_tag; // Dummy shutdown tag
|
|
|
|
ShutdownTag shutdown_tag; // Dummy shutdown tag
|
|
|
|
grpc_server_shutdown_and_notify(server_, shutdown_cq.cq(), &shutdown_tag); |
|
|
|
grpc_server_shutdown_and_notify(server_, shutdown_cq.cq(), &shutdown_tag); |
|
|
|
|
|
|
|
|
|
|
|
// Shutdown all ThreadManagers. This will try to gracefully stop all the
|
|
|
|
|
|
|
|
// threads in the ThreadManagers (once they process any inflight requests)
|
|
|
|
|
|
|
|
for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { |
|
|
|
|
|
|
|
(*it)->Shutdown(); // ThreadManager's Shutdown()
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shutdown_cq.Shutdown(); |
|
|
|
shutdown_cq.Shutdown(); |
|
|
|
|
|
|
|
|
|
|
|
void* tag; |
|
|
|
void* tag; |
|
|
@ -531,6 +525,12 @@ void Server::ShutdownInternal(gpr_timespec deadline) { |
|
|
|
// Else in case of SHUTDOWN or GOT_EVENT, it means that the server has
|
|
|
|
// Else in case of SHUTDOWN or GOT_EVENT, it means that the server has
|
|
|
|
// successfully shutdown
|
|
|
|
// successfully shutdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Shutdown all ThreadManagers. This will try to gracefully stop all the
|
|
|
|
|
|
|
|
// threads in the ThreadManagers (once they process any inflight requests)
|
|
|
|
|
|
|
|
for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { |
|
|
|
|
|
|
|
(*it)->Shutdown(); // ThreadManager's Shutdown()
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Wait for threads in all ThreadManagers to terminate
|
|
|
|
// Wait for threads in all ThreadManagers to terminate
|
|
|
|
for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { |
|
|
|
for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { |
|
|
|
(*it)->Wait(); |
|
|
|
(*it)->Wait(); |
|
|
|