2012-05-11 08:59:07 +08:00
|
|
|
#ifndef _LINUX_TASK_WORK_H
|
|
|
|
#define _LINUX_TASK_WORK_H
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
|
2012-06-27 15:07:19 +08:00
|
|
|
typedef void (*task_work_func_t)(struct callback_head *);
|
2012-05-11 08:59:07 +08:00
|
|
|
|
|
|
|
static inline void
|
2012-06-27 15:07:19 +08:00
|
|
|
init_task_work(struct callback_head *twork, task_work_func_t func)
|
2012-05-11 08:59:07 +08:00
|
|
|
{
|
|
|
|
twork->func = func;
|
|
|
|
}
|
|
|
|
|
2012-06-27 15:07:19 +08:00
|
|
|
int task_work_add(struct task_struct *task, struct callback_head *twork, bool);
|
|
|
|
struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
|
2012-05-11 08:59:07 +08:00
|
|
|
void task_work_run(void);
|
|
|
|
|
|
|
|
static inline void exit_task_work(struct task_struct *task)
|
|
|
|
{
|
2012-06-27 13:24:13 +08:00
|
|
|
if (unlikely(task->task_works))
|
2012-05-11 08:59:07 +08:00
|
|
|
task_work_run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _LINUX_TASK_WORK_H */
|