aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/wait.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r--include/linux/wait.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1e1bf9f963a9..6aa09a875fbd 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -107,6 +107,27 @@ static inline int waitqueue_active(wait_queue_head_t *q)
107 return !list_empty(&q->task_list); 107 return !list_empty(&q->task_list);
108} 108}
109 109
110/**
111 * wq_has_sleeper - check if there are any waiting processes
112 * @wq: wait queue head
113 *
114 * Returns true if wq has waiting processes
115 *
116 * Please refer to the comment for waitqueue_active.
117 */
118static inline bool wq_has_sleeper(wait_queue_head_t *wq)
119{
120 /*
121 * We need to be sure we are in sync with the
122 * add_wait_queue modifications to the wait queue.
123 *
124 * This memory barrier should be paired with one on the
125 * waiting side.
126 */
127 smp_mb();
128 return waitqueue_active(wq);
129}
130
110extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 131extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
111extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); 132extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait);
112extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 133extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);