fix: avoid doing a poll when already shutdown

pull/14177/head
Jan Tattermusch 7 years ago
parent 80c9631ad0
commit 6fe650908f
  1. 5
      src/core/lib/iomgr/ev_epollex_linux.cc

@ -199,6 +199,7 @@ struct grpc_pollset {
pollable* active_pollable;
bool kicked_without_poller;
grpc_closure* shutdown_closure;
bool already_shutdown;
grpc_pollset_worker* root_worker;
int containing_pollset_set_count;
};
@ -562,6 +563,7 @@ static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) {
pollset->containing_pollset_set_count == 0) {
GRPC_CLOSURE_SCHED(pollset->shutdown_closure, GRPC_ERROR_NONE);
pollset->shutdown_closure = nullptr;
pollset->already_shutdown = true;
}
}
@ -862,7 +864,8 @@ static worker_remove_result worker_remove(grpc_pollset_worker** root_worker,
static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
grpc_pollset_worker** worker_hdl,
grpc_millis deadline) {
bool do_poll = (pollset->shutdown_closure == nullptr);
bool do_poll =
(pollset->shutdown_closure == nullptr && !pollset->already_shutdown);
if (worker_hdl != nullptr) *worker_hdl = worker;
worker->initialized_cv = false;
worker->kicked = false;

Loading…
Cancel
Save