From 537e2eda8d9fda2001295c835a4720def6a237f1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 21 Jul 2017 02:46:01 -0700 Subject: 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. --- src/core/pipe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/core/pipe.c') 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); -- cgit v1.2.3-70-g09d2