aboutsummaryrefslogtreecommitdiff
path: root/src/core/pipe.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-05 07:44:23 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-05 07:44:23 -0700
commit489805ce5aa17db6173db5e7dc8998f9f5882ae9 (patch)
tree4e7f1db02c5e049441af446fc5b55d4910866320 /src/core/pipe.c
parent23c4a6eab39c0d24ad0ff5d5ec7e9879b1788a9b (diff)
downloadnng-489805ce5aa17db6173db5e7dc8998f9f5882ae9.tar.gz
nng-489805ce5aa17db6173db5e7dc8998f9f5882ae9.tar.bz2
nng-489805ce5aa17db6173db5e7dc8998f9f5882ae9.zip
Minor improvements to reap start/stop logic.
Diffstat (limited to 'src/core/pipe.c')
-rw-r--r--src/core/pipe.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/core/pipe.c b/src/core/pipe.c
index 71434fcb..d13e703f 100644
--- a/src/core/pipe.c
+++ b/src/core/pipe.c
@@ -21,11 +21,9 @@ static nni_list nni_pipe_reap_list;
static nni_mtx nni_pipe_reap_lk;
static nni_cv nni_pipe_reap_cv;
static nni_thr nni_pipe_reap_thr;
-static int nni_pipe_reap_exit;
-static int nni_pipe_reap_start;
+static int nni_pipe_reap_run;
static void nni_pipe_reaper(void *);
-static void nni_pipe_destroy(nni_pipe *);
int
nni_pipe_sys_init(void)
@@ -49,7 +47,7 @@ nni_pipe_sys_init(void)
nni_idhash_set_limits(
nni_pipes, 1, 0x7fffffff, nni_random() & 0x7fffffff);
- nni_pipe_reap_start = 1;
+ nni_pipe_reap_run = 1;
nni_thr_run(&nni_pipe_reap_thr);
return (0);
@@ -58,9 +56,9 @@ nni_pipe_sys_init(void)
void
nni_pipe_sys_fini(void)
{
- if (nni_pipe_reap_start) {
+ if (nni_pipe_reap_run) {
nni_mtx_lock(&nni_pipe_reap_lk);
- nni_pipe_reap_exit = 1;
+ nni_pipe_reap_run = 0;
nni_cv_wake(&nni_pipe_reap_cv);
nni_mtx_unlock(&nni_pipe_reap_lk);
nni_thr_fini(&nni_pipe_reap_thr);
@@ -336,7 +334,7 @@ nni_pipe_reaper(void *notused)
nni_mtx_lock(&nni_pipe_reap_lk);
continue;
}
- if (nni_pipe_reap_exit) {
+ if (!nni_pipe_reap_run) {
break;
}
nni_cv_wait(&nni_pipe_reap_cv);