diff options
author | Ian Moffett <ian@osmora.org> | 2025-08-11 04:45:50 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-08-11 04:47:02 -0400 |
commit | fe74ae7b9b1f7c4ca203deabab4cdd17ff44d12d (patch) | |
tree | bf4cdaeacd46a879732e6aa280ec37d198e77fd8 /sys/include | |
parent | 0e16a67599051063cf78b9849a35ecd37e239095 (diff) |
kernel: workqueue: Fixup passing of 'func' in wq
This commit includes several changes:
- Improves documentation in sys/workqueue.h
- Removes useless 'func' field in workqueue structure
- Duplicate strings and introduce work_destroy()
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r-- | sys/include/sys/workqueue.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/include/sys/workqueue.h b/sys/include/sys/workqueue.h index 478751d..9925f79 100644 --- a/sys/include/sys/workqueue.h +++ b/sys/include/sys/workqueue.h @@ -50,12 +50,18 @@ typedef void(*workfunc_t)(struct workqueue *wqp, struct work *wp); * Represents work that may be added to a * workqueue. * - * @name: Name of this work/task - * @func: Function with work to be done - * @cookie: Used for validating the work structure + * @name: Name of this work/task [i] + * @data: Optional data to be passed with work [p] + * @func: Function with work to be done [p] + * @cookie: Used for validating the work structure [i] + * + * Field attributes: + * - [i]: Used internally + * - [p]: Used as parameter */ struct work { - const char *name; + char *name; + void *data; workfunc_t func; TAILQ_ENTRY(work) link; }; @@ -81,16 +87,15 @@ struct workqueue { size_t max_work; ssize_t nwork; uint16_t cookie; - workfunc_t func; struct proc *worktd; struct mutex *lock; }; -struct workqueue *workqueue_new(const char *name, workfunc_t func, - size_t max_work, int ipl); +struct workqueue *workqueue_new(const char *name, size_t max_work, int ipl); -int workqueue_enq(struct workqueue *wqp, struct work *wp); +int workqueue_enq(struct workqueue *wqp, const char *name, struct work *wp); int workqueue_destroy(struct workqueue *wqp); +int work_destroy(struct work *wp); #endif /* !_KERNEL */ #endif /* !_SYS_WORKQUEUE_H_ */ |