Manual browser: workqueue_destroy(9)
|WORKQUEUE(9)||Kernel Developer's Manual||WORKQUEUE(9)|
NAMEworkqueue — simple do-it-in-thread-context framework
workqueue_create(struct workqueue **wqp, const char *name, void (*func)(struct work *, void *), void *arg, pri_t prio, int ipl, int flags);
workqueue_enqueue(struct workqueue *wq, struct work *wk, struct cpu_info *ci);
workqueue_destroy(struct workqueue *wq);
DESCRIPTIONThe workqueue utility routines are provided to defer work which is needed to be processed in a thread context.
workqueue_create() creates a workqueue. It takes the following arguments:
- Specify where to store the created workqueue.
- The name of the workqueue.
- The function to be called for each work.
- An argument to be passed as a second argument of func.
- The priority level for the worker threads.
- The highest IPL at which this workqueue is used.
The value of 0 indicates a standard create operation, however the following flags may be bitwise ORed together:
- Specifies that the workqueue is multiprocessor safe and does its own locking, otherwise the kernel lock will be held while work will be processed.
- Specifies that the workqueue should have a separate queue for each CPU, thus the work could be enqueued on concrete CPUs.
workqueue_enqueue() enqueues the work wk into the workqueue wq.
If the WQ_PERCPU flag was set on workqueue creation, the ci argument may be used to specify the CPU on which the work should be enqueued. Also it may be NULL, then work will be enqueued on the current CPU. If WQ_PERCPU flag was not set, ci must be NULL.
The enqueued work will be processed in a thread context. A work must not be enqueued again until the callback is called by the workqueue framework.
workqueue_destroy() destroys a workqueue and frees associated resources. The caller should ensure that the workqueue has no work enqueued beforehand.
RETURN VALUESworkqueue_create() returns 0 on success. Otherwise, it returns an errno(2).
CODE REFERENCESThe workqueue subsystem is implemented within the file sys/kern/subr_workqueue.c.
|October 24, 2011||NetBSD 7.0|