diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-21 02:46:01 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-21 02:46:01 -0700 |
| commit | 537e2eda8d9fda2001295c835a4720def6a237f1 (patch) | |
| tree | 615d05096e0fe4c8bfbccf31f37c7256381ccd8e /src/core/pipe.c | |
| parent | 07078e1cf761cb6e56e46bde3ade6f792368d7dd (diff) | |
| download | nng-537e2eda8d9fda2001295c835a4720def6a237f1.tar.gz nng-537e2eda8d9fda2001295c835a4720def6a237f1.tar.bz2 nng-537e2eda8d9fda2001295c835a4720def6a237f1.zip | |
Simpler taskq API.
The queue is bound at initialization time of the task, and we call
entries just tasks, so we don't have to pass around a taskq pointer
across all the calls. Further, nni_task_dispatch is now guaranteed
to succeed.
Diffstat (limited to 'src/core/pipe.c')
| -rw-r--r-- | src/core/pipe.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/pipe.c b/src/core/pipe.c index 5b51a38b..9247ec0f 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -158,8 +158,7 @@ nni_pipe_stop(nni_pipe *p) return; } p->p_stop = 1; - nni_taskq_ent_init(&p->p_reap_tqe, (nni_cb) nni_pipe_reap, p); - nni_taskq_dispatch(NULL, &p->p_reap_tqe); + nni_task_dispatch(&p->p_reap_task); nni_mtx_unlock(&p->p_mtx); } @@ -209,6 +208,8 @@ nni_pipe_create(nni_ep *ep, void *tdata) p->p_tran_data = tdata; p->p_proto_data = NULL; + nni_task_init(NULL, &p->p_reap_task, (nni_cb) nni_pipe_reap, p); + if (((rv = nni_mtx_init(&p->p_mtx)) != 0) || ((rv = nni_cv_init(&p->p_cv, &p->p_mtx)) != 0)) { tran->tran_pipe->p_fini(p); |
