1/* Public domain. */
2
3#ifndef _LINUX_KTHREAD_H
4#define _LINUX_KTHREAD_H
5
6/* both for printf */
7#include <sys/types.h>
8#include <sys/systm.h>
9#include <sys/task.h>
10
11struct proc *kthread_run(int (*)(void *), void *, const char *);
12void 	kthread_park(struct proc *);
13void 	kthread_unpark(struct proc *);
14int	kthread_should_park(void);
15void 	kthread_parkme(void);
16void	kthread_stop(struct proc *);
17int	kthread_should_stop(void);
18
19struct kthread_work {
20	struct task	 task;
21	struct taskq	*tq;
22};
23
24struct kthread_worker {
25	struct taskq	*tq;
26};
27
28struct kthread_worker *
29	kthread_create_worker(unsigned int, const char *, ...);
30void	kthread_destroy_worker(struct kthread_worker *);
31void	kthread_init_work(struct kthread_work *, void (*)(struct kthread_work *));
32bool	kthread_queue_work(struct kthread_worker *, struct kthread_work *);
33bool	kthread_cancel_work_sync(struct kthread_work *);
34void	kthread_flush_work(struct kthread_work *);
35void	kthread_flush_worker(struct kthread_worker *);
36
37#endif
38