diff options
| author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-07-27 22:11:24 +0000 |
|---|---|---|
| committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-07-27 22:11:24 +0000 |
| commit | ce6a36c7f7c88e7ca0fda816f9282237bb86829d (patch) | |
| tree | 611bf9beb2281d34260ca87fc189a0ddc864819a /libdde-linux26/libdde_linux26/contrib/include/linux/kthread.h | |
| parent | bb9d6cd642f9189b8102d566c8c46a6de1d2c5f7 (diff) | |
| parent | 4fbe7358c7747a9165f776eb19addbb9baf7def2 (diff) | |
Merge branch 'upstream-merged'
Diffstat (limited to 'libdde-linux26/libdde_linux26/contrib/include/linux/kthread.h')
| -rw-r--r-- | libdde-linux26/libdde_linux26/contrib/include/linux/kthread.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libdde-linux26/libdde_linux26/contrib/include/linux/kthread.h b/libdde-linux26/libdde_linux26/contrib/include/linux/kthread.h new file mode 100644 index 00000000..aabc8a13 --- /dev/null +++ b/libdde-linux26/libdde_linux26/contrib/include/linux/kthread.h @@ -0,0 +1,37 @@ +#ifndef _LINUX_KTHREAD_H +#define _LINUX_KTHREAD_H +/* Simple interface for creating and stopping kernel threads without mess. */ +#include <linux/err.h> +#include <linux/sched.h> + +struct task_struct *kthread_create(int (*threadfn)(void *data), + void *data, + const char namefmt[], ...) + __attribute__((format(printf, 3, 4))); + +/** + * kthread_run - create and wake a thread. + * @threadfn: the function to run until signal_pending(current). + * @data: data ptr for @threadfn. + * @namefmt: printf-style name for the thread. + * + * Description: Convenient wrapper for kthread_create() followed by + * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM). + */ +#define kthread_run(threadfn, data, namefmt, ...) \ +({ \ + struct task_struct *__k \ + = kthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \ + if (!IS_ERR(__k)) \ + wake_up_process(__k); \ + __k; \ +}) + +void kthread_bind(struct task_struct *k, unsigned int cpu); +int kthread_stop(struct task_struct *k); +int kthread_should_stop(void); + +int kthreadd(void *unused); +extern struct task_struct *kthreadd_task; + +#endif /* _LINUX_KTHREAD_H */ |
