blob: bd9a6a91c097e2c8c0806590353e44ee2a1b9d23 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Oleg Nesterove73f8952012-05-11 10:59:07 +10002#ifndef _LINUX_TASK_WORK_H
3#define _LINUX_TASK_WORK_H
4
5#include <linux/list.h>
6#include <linux/sched.h>
7
Al Viro67d12142012-06-27 11:07:19 +04008typedef void (*task_work_func_t)(struct callback_head *);
Oleg Nesterove73f8952012-05-11 10:59:07 +10009
10static inline void
Al Viro67d12142012-06-27 11:07:19 +040011init_task_work(struct callback_head *twork, task_work_func_t func)
Oleg Nesterove73f8952012-05-11 10:59:07 +100012{
13 twork->func = func;
Oleg Nesterove73f8952012-05-11 10:59:07 +100014}
15
Al Viro67d12142012-06-27 11:07:19 +040016int task_work_add(struct task_struct *task, struct callback_head *twork, bool);
17struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
Oleg Nesterove73f8952012-05-11 10:59:07 +100018void task_work_run(void);
19
20static inline void exit_task_work(struct task_struct *task)
21{
Oleg Nesterov9da33de2012-08-26 21:12:11 +020022 task_work_run();
Oleg Nesterove73f8952012-05-11 10:59:07 +100023}
24
25#endif /* _LINUX_TASK_WORK_H */