Merge pull request #1269 from ctiller/racefix

Fix race on shutdown
pull/1277/head
jboeuf 10 years ago
commit dcfe504a99
  1. 3
      src/core/iomgr/tcp_server_posix.c

@ -174,7 +174,6 @@ void grpc_tcp_server_destroy(
while (s->active_ports) { while (s->active_ports) {
gpr_cv_wait(&s->cv, &s->mu, gpr_inf_future); gpr_cv_wait(&s->cv, &s->mu, gpr_inf_future);
} }
gpr_mu_unlock(&s->mu);
/* delete ALL the things */ /* delete ALL the things */
if (s->nports) { if (s->nports) {
@ -185,7 +184,9 @@ void grpc_tcp_server_destroy(
} }
grpc_fd_orphan(sp->emfd, destroyed_port, s); grpc_fd_orphan(sp->emfd, destroyed_port, s);
} }
gpr_mu_unlock(&s->mu);
} else { } else {
gpr_mu_unlock(&s->mu);
finish_shutdown(s); finish_shutdown(s);
} }
} }

Loading…
Cancel
Save