aboutsummaryrefslogtreecommitdiff
path: root/src/core/taskq.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-01-05 21:13:14 -0800
committerGarrett D'Amore <garrett@damore.org>2020-01-06 07:20:58 -0800
commit8479b4c8861c77cfd9eb64e724615605bdd1cbcb (patch)
tree6fdd38384831ff9d2bcb6552b122c404fc9713cb /src/core/taskq.h
parent758a9e8295251ddaf9cebd973f8394a4b25eb9d4 (diff)
downloadnng-8479b4c8861c77cfd9eb64e724615605bdd1cbcb.tar.gz
nng-8479b4c8861c77cfd9eb64e724615605bdd1cbcb.tar.bz2
nng-8479b4c8861c77cfd9eb64e724615605bdd1cbcb.zip
fixes #1117 task structures should be inlined
Diffstat (limited to 'src/core/taskq.h')
-rw-r--r--src/core/taskq.h16
1 files changed, 15 insertions, 1 deletions
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