aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-05 08:06:35 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-05 08:06:35 -0700
commit7ec0c70ca43f9d1020f3017282c749660aefbc05 (patch)
tree98dfe0170147e565393fd5061cdbec32a65d04df /src
parent489805ce5aa17db6173db5e7dc8998f9f5882ae9 (diff)
downloadnng-7ec0c70ca43f9d1020f3017282c749660aefbc05.tar.gz
nng-7ec0c70ca43f9d1020f3017282c749660aefbc05.tar.bz2
nng-7ec0c70ca43f9d1020f3017282c749660aefbc05.zip
Don't shut down taskq too soon.
With the new reapers, we've seen some problems caused by the reaper running after the taskq that they have to wait on (completion tasks for aios) are destroyed. We need to make sure that we tear down major subsystems in the correct order.
Diffstat (limited to 'src')
-rw-r--r--src/core/endpt.c2
-rw-r--r--src/core/init.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c
index 68efaae5..0a5862f0 100644
--- a/src/core/endpt.c
+++ b/src/core/endpt.c
@@ -130,6 +130,7 @@ nni_ep_create(nni_ep **epp, nni_sock *sock, const char *addr, int mode)
ep->ep_refcnt = 0;
NNI_LIST_NODE_INIT(&ep->ep_node);
+ NNI_LIST_NODE_INIT(&ep->ep_reap_node);
nni_pipe_ep_list_init(&ep->ep_pipes);
@@ -253,6 +254,7 @@ nni_ep_stop(nni_ep *ep)
nni_mtx_unlock(&ep->ep_mtx);
nni_mtx_lock(&nni_ep_reap_lk);
+ NNI_ASSERT(!nni_list_node_active(&ep->ep_reap_node));
nni_list_append(&nni_ep_reap_list, ep);
nni_cv_wake(&nni_ep_reap_cv);
nni_mtx_unlock(&nni_ep_reap_lk);
diff --git a/src/core/init.c b/src/core/init.c
index 0c294506..7de2a497 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -69,13 +69,13 @@ nni_fini(void)
{
// XXX: We should make sure that underlying sockets and
// file descriptors are closed. Details TBD.
- nni_taskq_sys_fini();
nni_tran_sys_fini();
nni_pipe_sys_fini();
nni_ep_sys_fini();
nni_sock_sys_fini();
nni_random_sys_fini();
- nni_timer_sys_fini();
nni_aio_sys_fini();
+ nni_timer_sys_fini();
+ nni_taskq_sys_fini();
nni_plat_fini();
}