| .. | .. |
|---|
| 24 | 24 | * called near the end of a function. Otherwise, the list can be |
|---|
| 25 | 25 | * re-initialized for later re-use by wake_q_init(). |
|---|
| 26 | 26 | * |
|---|
| 27 | | - * Note that this can cause spurious wakeups. schedule() callers |
|---|
| 27 | + * NOTE that this can cause spurious wakeups. schedule() callers |
|---|
| 28 | 28 | * must ensure the call is done inside a loop, confirming that the |
|---|
| 29 | 29 | * wakeup condition has in fact occurred. |
|---|
| 30 | + * |
|---|
| 31 | + * NOTE that there is no guarantee the wakeup will happen any later than the |
|---|
| 32 | + * wake_q_add() location. Therefore task must be ready to be woken at the |
|---|
| 33 | + * location of the wake_q_add(). |
|---|
| 30 | 34 | */ |
|---|
| 31 | 35 | |
|---|
| 32 | 36 | #include <linux/sched.h> |
|---|
| .. | .. |
|---|
| 49 | 53 | head->count = 0; |
|---|
| 50 | 54 | } |
|---|
| 51 | 55 | |
|---|
| 52 | | -extern void __wake_q_add(struct wake_q_head *head, |
|---|
| 53 | | - struct task_struct *task, bool sleeper); |
|---|
| 54 | | -static inline void wake_q_add(struct wake_q_head *head, |
|---|
| 55 | | - struct task_struct *task) |
|---|
| 56 | +static inline bool wake_q_empty(struct wake_q_head *head) |
|---|
| 56 | 57 | { |
|---|
| 57 | | - __wake_q_add(head, task, false); |
|---|
| 58 | + return head->first == WAKE_Q_TAIL; |
|---|
| 58 | 59 | } |
|---|
| 59 | 60 | |
|---|
| 60 | | -static inline void wake_q_add_sleeper(struct wake_q_head *head, |
|---|
| 61 | | - struct task_struct *task) |
|---|
| 62 | | -{ |
|---|
| 63 | | - __wake_q_add(head, task, true); |
|---|
| 64 | | -} |
|---|
| 65 | | - |
|---|
| 66 | | -extern void __wake_up_q(struct wake_q_head *head, bool sleeper); |
|---|
| 67 | | -static inline void wake_up_q(struct wake_q_head *head) |
|---|
| 68 | | -{ |
|---|
| 69 | | - __wake_up_q(head, false); |
|---|
| 70 | | -} |
|---|
| 71 | | - |
|---|
| 72 | | -static inline void wake_up_q_sleeper(struct wake_q_head *head) |
|---|
| 73 | | -{ |
|---|
| 74 | | - __wake_up_q(head, true); |
|---|
| 75 | | -} |
|---|
| 61 | +extern void wake_q_add(struct wake_q_head *head, struct task_struct *task); |
|---|
| 62 | +extern void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task); |
|---|
| 63 | +extern void wake_up_q(struct wake_q_head *head); |
|---|
| 76 | 64 | |
|---|
| 77 | 65 | #endif /* _LINUX_SCHED_WAKE_Q_H */ |
|---|