| .. | .. |
|---|
| 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); |
|---|
| 56 | +static inline bool wake_q_empty(struct wake_q_head *head) |
|---|
| 57 | +{ |
|---|
| 58 | + return head->first == WAKE_Q_TAIL; |
|---|
| 59 | +} |
|---|
| 60 | + |
|---|
| 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); |
|---|
| 54 | 63 | extern void wake_up_q(struct wake_q_head *head); |
|---|
| 55 | 64 | |
|---|
| 56 | 65 | #endif /* _LINUX_SCHED_WAKE_Q_H */ |
|---|