From 70c6f49a552b97b455d9f9c4419129463a30847d Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 19 Jan 2017 13:47:47 -0800 Subject: Thread fini shouldl be idempotent. --- src/core/thread.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core/thread.c') diff --git a/src/core/thread.c b/src/core/thread.c index 91bacdec..74a434f9 100644 --- a/src/core/thread.c +++ b/src/core/thread.c @@ -152,6 +152,9 @@ nni_thr_run(nni_thr *thr) void nni_thr_wait(nni_thr *thr) { + if (!thr->init) { + return; + } nni_plat_mtx_lock(&thr->mtx); thr->stop = 1; nni_plat_cv_wake(&thr->cv); @@ -181,4 +184,5 @@ nni_thr_fini(nni_thr *thr) nni_plat_cv_fini(&thr->cv); nni_plat_mtx_fini(&thr->mtx); + thr->init = 0; } -- cgit v1.2.3-70-g09d2