aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-14 01:07:14 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-14 13:43:01 -0700
commit827aed05d352c470c8b4b8a7e232e21e1cd19313 (patch)
treeefa08531fd37a08de7eff82cb9f946be6a0996ae /src
parent46c0fb89b06331b44a51cb7e56f0fb2fe3281a4b (diff)
downloadnng-827aed05d352c470c8b4b8a7e232e21e1cd19313.tar.gz
nng-827aed05d352c470c8b4b8a7e232e21e1cd19313.tar.bz2
nng-827aed05d352c470c8b4b8a7e232e21e1cd19313.zip
Idempotent taskq finalizers.
Diffstat (limited to 'src')
-rw-r--r--src/core/taskq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/taskq.c b/src/core/taskq.c
index 8d42701e..e0fc456c 100644
--- a/src/core/taskq.c
+++ b/src/core/taskq.c
@@ -149,7 +149,9 @@ nni_taskq_fini(nni_taskq *tq)
// First drain the taskq completely. This is necessary since some
// tasks that are presently running may need to schedule additional
// tasks, and we don't want those to block.
-
+ if (tq == NULL) {
+ return;
+ }
if (tq->tq_run) {
nni_mtx_lock(&tq->tq_mtx);
nni_taskq_drain_locked(tq);
@@ -274,4 +276,5 @@ void
nni_taskq_sys_fini(void)
{
nni_taskq_fini(nni_taskq_systq);
+ nni_taskq_systq = NULL;
}