diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-01-05 21:13:14 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-01-06 07:20:58 -0800 |
| commit | 8479b4c8861c77cfd9eb64e724615605bdd1cbcb (patch) | |
| tree | 6fdd38384831ff9d2bcb6552b122c404fc9713cb /src/core/taskq.c | |
| parent | 758a9e8295251ddaf9cebd973f8394a4b25eb9d4 (diff) | |
| download | nng-8479b4c8861c77cfd9eb64e724615605bdd1cbcb.tar.gz nng-8479b4c8861c77cfd9eb64e724615605bdd1cbcb.tar.bz2 nng-8479b4c8861c77cfd9eb64e724615605bdd1cbcb.zip | |
fixes #1117 task structures should be inlined
Diffstat (limited to 'src/core/taskq.c')
| -rw-r--r-- | src/core/taskq.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/core/taskq.c b/src/core/taskq.c index f9b08f30..09e822df 100644 --- a/src/core/taskq.c +++ b/src/core/taskq.c @@ -11,16 +11,6 @@ #include "core/nng_impl.h" typedef struct nni_taskq_thr nni_taskq_thr; -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; -}; struct nni_taskq_thr { nni_taskq *tqt_tq; nni_thr tqt_thread; @@ -203,14 +193,9 @@ nni_task_wait(nni_task *task) nni_mtx_unlock(&task->task_mtx); } -int -nni_task_init(nni_task **taskp, nni_taskq *tq, nni_cb cb, void *arg) +void +nni_task_init(nni_task *task, nni_taskq *tq, nni_cb cb, void *arg) { - nni_task *task; - - if ((task = NNI_ALLOC_STRUCT(task)) == NULL) { - return (NNG_ENOMEM); - } NNI_LIST_NODE_INIT(&task->task_node); nni_mtx_init(&task->task_mtx); nni_cv_init(&task->task_cv, &task->task_mtx); @@ -219,8 +204,6 @@ nni_task_init(nni_task **taskp, nni_taskq *tq, nni_cb cb, void *arg) task->task_cb = cb; task->task_arg = arg; task->task_tq = tq != NULL ? tq : nni_taskq_systq; - *taskp = task; - return (0); } void @@ -233,7 +216,6 @@ nni_task_fini(nni_task *task) nni_mtx_unlock(&task->task_mtx); nni_cv_fini(&task->task_cv); nni_mtx_fini(&task->task_mtx); - NNI_FREE_STRUCT(task); } int |
