From 827aed05d352c470c8b4b8a7e232e21e1cd19313 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 14 Aug 2017 01:07:14 -0700 Subject: Idempotent taskq finalizers. --- src/core/taskq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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; } -- cgit v1.2.3-70-g09d2