From 8479b4c8861c77cfd9eb64e724615605bdd1cbcb Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 5 Jan 2020 21:13:14 -0800 Subject: fixes #1117 task structures should be inlined --- src/core/taskq.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/core/taskq.h') diff --git a/src/core/taskq.h b/src/core/taskq.h index 8328e4eb..53f9d35b 100644 --- a/src/core/taskq.h +++ b/src/core/taskq.h @@ -39,7 +39,7 @@ extern void nni_task_exec(nni_task *); extern void nni_task_prep(nni_task *); extern void nni_task_wait(nni_task *); -extern int nni_task_init(nni_task **, nni_taskq *, nni_cb, void *); +extern void nni_task_init(nni_task *, nni_taskq *, nni_cb, void *); // nni_task_fini destroys the task. It will reap resources asynchronously // if the task is currently executing. Use nni_task_wait() first if the @@ -50,4 +50,18 @@ extern void nni_task_fini(nni_task *); extern int nni_taskq_sys_init(void); extern void nni_taskq_sys_fini(void); +// nni_task implementation details are not to be used except by the +// nni_task_framework. Placing here allows for inlining this in +// consuming structures. +struct nni_task { + nni_list_node task_node; + void * task_arg; + nni_cb task_cb; + nni_taskq * task_tq; + unsigned task_busy; + bool task_prep; + nni_mtx task_mtx; + nni_cv task_cv; +}; + #endif // CORE_TASKQ_H -- cgit v1.2.3-70-g09d2