blob: ca5a1cf27daeb9487303dd29d9c58a9e571ecfb4 [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{
Oleg Nesterov9da33de2012-08-26 21:12:11 +020021 task_work_run();
Oleg Nesterove73f8952012-05-11 10:59:07 +100022}
23
24#endif /* _LINUX_TASK_WORK_H */