diff options
Diffstat (limited to 'src/core/endpt.c')
| -rw-r--r-- | src/core/endpt.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c index 74bd0314..e3f78ecd 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -203,14 +203,7 @@ nni_ep_stop(nni_ep *ep) void nni_ep_close(nni_ep *ep) { - nni_pipe *pipe; - nni_ep_stop(ep); - nni_mtx_lock(&ep->ep_mtx); - NNI_LIST_FOREACH (&ep->ep_pipes, pipe) { - nni_pipe_close(pipe); - } - nni_mtx_unlock(&ep->ep_mtx); } @@ -220,7 +213,15 @@ nni_ep_remove(nni_ep *ep) nni_pipe *pipe; nni_sock *sock = ep->ep_sock; - nni_ep_close(ep); + nni_ep_stop(ep); + + nni_thr_wait(&ep->ep_thr); + + nni_mtx_lock(&ep->ep_mtx); + NNI_LIST_FOREACH (&ep->ep_pipes, pipe) { + nni_pipe_close(pipe); + } + nni_mtx_unlock(&ep->ep_mtx); nni_mtx_lock(&ep->ep_mtx); while (nni_list_first(&ep->ep_pipes) != NULL) { |
