2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2012-05-11 10:59:07 +10:00
|
|
|
#ifndef _LINUX_TASK_WORK_H
|
|
|
|
|
#define _LINUX_TASK_WORK_H
|
|
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
|
#include <linux/sched.h>
|
|
|
|
|
|
2012-06-27 11:07:19 +04:00
|
|
|
typedef void (*task_work_func_t)(struct callback_head *);
|
2012-05-11 10:59:07 +10:00
|
|
|
|
|
|
|
|
static inline void
|
2012-06-27 11:07:19 +04:00
|
|
|
init_task_work(struct callback_head *twork, task_work_func_t func)
|
2012-05-11 10:59:07 +10:00
|
|
|
{
|
|
|
|
|
twork->func = func;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-16 09:02:26 -06:00
|
|
|
enum task_work_notify_mode {
|
|
|
|
|
TWA_NONE,
|
|
|
|
|
TWA_RESUME,
|
|
|
|
|
TWA_SIGNAL,
|
2022-04-28 17:25:16 -06:00
|
|
|
TWA_SIGNAL_NO_IPI,
|
2020-10-16 09:02:26 -06:00
|
|
|
};
|
|
|
|
|
|
2022-02-09 08:52:41 -06:00
|
|
|
static inline bool task_work_pending(struct task_struct *task)
|
|
|
|
|
{
|
|
|
|
|
return READ_ONCE(task->task_works);
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-16 09:02:26 -06:00
|
|
|
int task_work_add(struct task_struct *task, struct callback_head *twork,
|
|
|
|
|
enum task_work_notify_mode mode);
|
2020-06-30 17:32:54 +02:00
|
|
|
|
2021-04-01 19:53:29 -06:00
|
|
|
struct callback_head *task_work_cancel_match(struct task_struct *task,
|
|
|
|
|
bool (*match)(struct callback_head *, void *data), void *data);
|
2012-06-27 11:07:19 +04:00
|
|
|
struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
|
2012-05-11 10:59:07 +10:00
|
|
|
void task_work_run(void);
|
|
|
|
|
|
|
|
|
|
static inline void exit_task_work(struct task_struct *task)
|
|
|
|
|
{
|
2012-08-26 21:12:11 +02:00
|
|
|
task_work_run();
|
2012-05-11 10:59:07 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* _LINUX_TASK_WORK_H */
|