aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/taskq.c5
-rw-r--r--tests/sock.c2
2 files changed, 6 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;
}
diff --git a/tests/sock.c b/tests/sock.c
index 8b3083ee..56159aae 100644
--- a/tests/sock.c
+++ b/tests/sock.c
@@ -14,6 +14,8 @@
TestMain("Socket Operations", {
+ Reset({ nng_fini(); });
+
Convey("We are able to open a PAIR socket", {
int rv;
nng_socket s1;