Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_TASK_WORK_H
0003 #define _LINUX_TASK_WORK_H
0004 
0005 #include <linux/list.h>
0006 #include <linux/sched.h>
0007 
0008 typedef void (*task_work_func_t)(struct callback_head *);
0009 
0010 static inline void
0011 init_task_work(struct callback_head *twork, task_work_func_t func)
0012 {
0013     twork->func = func;
0014 }
0015 
0016 enum task_work_notify_mode {
0017     TWA_NONE,
0018     TWA_RESUME,
0019     TWA_SIGNAL,
0020     TWA_SIGNAL_NO_IPI,
0021 };
0022 
0023 static inline bool task_work_pending(struct task_struct *task)
0024 {
0025     return READ_ONCE(task->task_works);
0026 }
0027 
0028 int task_work_add(struct task_struct *task, struct callback_head *twork,
0029             enum task_work_notify_mode mode);
0030 
0031 struct callback_head *task_work_cancel_match(struct task_struct *task,
0032     bool (*match)(struct callback_head *, void *data), void *data);
0033 struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
0034 void task_work_run(void);
0035 
0036 static inline void exit_task_work(struct task_struct *task)
0037 {
0038     task_work_run();
0039 }
0040 
0041 #endif  /* _LINUX_TASK_WORK_H */