aboutsummaryrefslogtreecommitdiff
path: root/src/core/thread.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-19 13:47:47 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-19 13:47:47 -0800
commit70c6f49a552b97b455d9f9c4419129463a30847d (patch)
treee5512a48a48f62e152e29e2aeb7be8d685e2f341 /src/core/thread.c
parent09e7b2f6fa394943a151c79e3b1086834f643497 (diff)
downloadnng-70c6f49a552b97b455d9f9c4419129463a30847d.tar.gz
nng-70c6f49a552b97b455d9f9c4419129463a30847d.tar.bz2
nng-70c6f49a552b97b455d9f9c4419129463a30847d.zip
Thread fini shouldl be idempotent.
Diffstat (limited to 'src/core/thread.c')
-rw-r--r--src/core/thread.c4
1 files changed, 4 insertions, 0 deletions
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;
}