blob: fb46b03b18522752538bfae6e192804e9629fc2a [file] [log] [blame]
Oleg Nesterove73f8952012-05-11 10:59:07 +10001#ifndef _LINUX_TASK_WORK_H
2#define _LINUX_TASK_WORK_H
3
4#include <linux/list.h>
5#include <linux/sched.h>
6
Al Viro67d12142012-06-27 11:07:19 +04007typedef void (*task_work_func_t)(struct callback_head *);
Oleg Nesterove73f8952012-05-11 10:59:07 +10008
9static inline void
Al Viro67d12142012-06-27 11:07:19 +040010init_task_work(struct callback_head *twork, task_work_func_t func)
Oleg Nesterove73f8952012-05-11 10:59:07 +100011{
12 twork->func = func;
Oleg Nesterove73f8952012-05-11 10:59:07 +100013}
14
Al Viro67d12142012-06-27 11:07:19 +040015int task_work_add(struct task_struct *task, struct callback_head *twork, bool);
16struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
Oleg Nesterove73f8952012-05-11 10:59:07 +100017void task_work_run(void);
18
19static inline void exit_task_work(struct task_struct *task)
20{
Al Viro158e1642012-06-27 09:24:13 +040021 if (unlikely(task->task_works))
Oleg Nesterove73f8952012-05-11 10:59:07 +100022 task_work_run();
23}
24
25#endif /* _LINUX_TASK_WORK_H */