aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/reap.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/core/reap.c b/src/core/reap.c
index 8be5ee12..3f182205 100644
--- a/src/core/reap.c
+++ b/src/core/reap.c
@@ -1,5 +1,5 @@
//
-// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2017 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -17,11 +17,11 @@
// New stuff.
static nni_reap_list *reap_list = NULL;
static nni_thr reap_thr;
-static bool reap_exit;
-static nni_mtx reap_mtx;
+static bool reap_exit = false;
+static nni_mtx reap_mtx = NNI_MTX_INITIALIZER;
static bool reap_empty;
-static nni_cv reap_work_cv;
-static nni_cv reap_empty_cv;
+static nni_cv reap_work_cv = NNI_CV_INITIALIZER(&reap_mtx);
+static nni_cv reap_empty_cv = NNI_CV_INITIALIZER(&reap_mtx);
static void
reap_worker(void *unused)
@@ -105,17 +105,9 @@ nni_reap_sys_init(void)
{
int rv;
- reap_exit = false;
- nni_mtx_init(&reap_mtx);
- nni_cv_init(&reap_work_cv, &reap_mtx);
- nni_cv_init(&reap_empty_cv, &reap_mtx);
-
// If this fails, we don't fail init, instead we will try to
// start up at reap time.
if ((rv = nni_thr_init(&reap_thr, reap_worker, NULL)) != 0) {
- nni_cv_fini(&reap_work_cv);
- nni_cv_fini(&reap_empty_cv);
- nni_mtx_fini(&reap_mtx);
return (rv);
}
nni_thr_run(&reap_thr);