Lines Matching +full:wait +full:- +full:state
1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Linux wait queue related types and methods
26 * A single wait-queue entry structure:
82 wq_entry->flags = 0; in init_waitqueue_entry()
83 wq_entry->private = p; in init_waitqueue_entry()
84 wq_entry->func = default_wake_function; in init_waitqueue_entry()
90 wq_entry->flags = 0; in init_waitqueue_func_entry()
91 wq_entry->private = NULL; in init_waitqueue_func_entry()
92 wq_entry->func = func; in init_waitqueue_func_entry()
96 * waitqueue_active -- locklessly test for waiters on the queue
99 * returns true if the wait list is not empty
102 * lead to sporadic and non-obvious failure.
107 * CPU0 - waker CPU1 - waiter
110 * @cond = true; prepare_to_wait(&wq_head, &wait, state);
116 * finish_wait(&wq_head, &wait);
120 * observe an empty wait list while the waiter might not observe @cond.
127 return !list_empty(&wq_head->head); in waitqueue_active()
131 * wq_has_single_sleeper - check if there is only one sleeper
132 * @wq_head: wait queue head
140 return list_is_singular(&wq_head->head); in wq_has_single_sleeper()
144 * wq_has_sleeper - check if there are any waiting processes
145 * @wq_head: wait queue head
155 * add_wait_queue modifications to the wait queue. in wq_has_sleeper()
171 struct list_head *head = &wq_head->head; in __add_wait_queue()
174 list_for_each_entry(wq, &wq_head->head, entry) { in __add_wait_queue()
175 if (!(wq->flags & WQ_FLAG_PRIORITY)) in __add_wait_queue()
177 head = &wq->entry; in __add_wait_queue()
179 list_add(&wq_entry->entry, head); in __add_wait_queue()
183 * Used for wake-one threads:
188 wq_entry->flags |= WQ_FLAG_EXCLUSIVE; in __add_wait_queue_exclusive()
194 list_add_tail(&wq_entry->entry, &wq_head->head); in __add_wait_queue_entry_tail()
200 wq_entry->flags |= WQ_FLAG_EXCLUSIVE; in __add_wait_queue_entry_tail_exclusive()
207 list_del(&wq_entry->entry); in __remove_wait_queue()
249 * wake_up_pollfree - signal that a polled waitqueue is going away
250 * @wq_head: the wait queue head
252 * In the very rare cases where a ->poll() implementation uses a waitqueue whose
255 * non-blocking polls (e.g. epoll) are notified that the queue is going away.
257 * The caller must also RCU-delay the freeing of the wait_queue_head, e.g. via
267 * can safely proceed with an RCU-delayed free. in wake_up_pollfree()
281 #define ___wait_is_interruptible(state) \ argument
282 (!__builtin_constant_p(state) || \
283 (state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
299 #define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \ argument
307 long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);\
312 if (___wait_is_interruptible(state) && __int) { \
328 * wait_event - sleep until a condition gets true
329 * @wq_head: the waitqueue to wait on
330 * @condition: a C expression for the event to wait for
337 * change the result of the wait condition.
352 * io_wait_event() -- like wait_event() but with io_schedule()
367 * wait_event_freezable - sleep (or freeze) until a condition gets true
368 * @wq_head: the waitqueue to wait on
369 * @condition: a C expression for the event to wait for
371 * The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
376 * change the result of the wait condition.
393 * wait_event_timeout - sleep until a condition gets true or a timeout elapses
394 * @wq_head: the waitqueue to wait on
395 * @condition: a C expression for the event to wait for
403 * change the result of the wait condition.
426 * like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
456 * wait_event_cmd - sleep until a condition gets true
457 * @wq_head: the waitqueue to wait on
458 * @condition: a C expression for the event to wait for
467 * change the result of the wait condition.
481 * wait_event_interruptible - sleep until a condition gets true
482 * @wq_head: the waitqueue to wait on
483 * @condition: a C expression for the event to wait for
490 * change the result of the wait condition.
492 * The function will return -ERESTARTSYS if it was interrupted by a
510 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
511 * @wq_head: the waitqueue to wait on
512 * @condition: a C expression for the event to wait for
520 * change the result of the wait condition.
526 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
539 #define __wait_event_hrtimeout(wq_head, condition, timeout, state) \ argument
548 current->timer_slack_ns); \
552 __ret = ___wait_event(wq_head, condition, state, 0, 0, \
554 __ret = -ETIME; \
565 * wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses
566 * @wq_head: the waitqueue to wait on
567 * @condition: a C expression for the event to wait for
575 * change the result of the wait condition.
577 * The function returns 0 if @condition became true, or -ETIME if the timeout
591 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
592 * @wq: the waitqueue to wait on
593 * @condition: a C expression for the event to wait for
601 * change the result of the wait condition.
603 * The function returns 0 if @condition became true, -ERESTARTSYS if it was
604 * interrupted by a signal, or -ETIME if the timeout elapsed.
657 * wait_event_idle - wait for a condition without contributing to system load
658 * @wq_head: the waitqueue to wait on
659 * @condition: a C expression for the event to wait for
666 * change the result of the wait condition.
677 * wait_event_idle_exclusive - wait for a condition with contributing to system load
678 * @wq_head: the waitqueue to wait on
679 * @condition: a C expression for the event to wait for
685 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
686 * set thus if other processes wait on the same list, when this
690 * change the result of the wait condition.
706 * wait_event_idle_timeout - sleep without load until a condition becomes true or a timeout elapses
707 * @wq_head: the waitqueue to wait on
708 * @condition: a C expression for the event to wait for
716 * change the result of the wait condition.
739 …* wait_event_idle_exclusive_timeout - sleep without load until a condition becomes true or a timeo…
740 * @wq_head: the waitqueue to wait on
741 * @condition: a C expression for the event to wait for
748 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
749 * set thus if other processes wait on the same list, when this
753 * change the result of the wait condition.
791 * wait_event_interruptible_locked - sleep until a condition gets true
792 * @wq: the waitqueue to wait on
793 * @condition: a C expression for the event to wait for
808 * change the result of the wait condition.
810 * The function will return -ERESTARTSYS if it was interrupted by a
818 * wait_event_interruptible_locked_irq - sleep until a condition gets true
819 * @wq: the waitqueue to wait on
820 * @condition: a C expression for the event to wait for
835 * change the result of the wait condition.
837 * The function will return -ERESTARTSYS if it was interrupted by a
845 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
846 * @wq: the waitqueue to wait on
847 * @condition: a C expression for the event to wait for
861 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
866 * change the result of the wait condition.
868 * The function will return -ERESTARTSYS if it was interrupted by a
876 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
877 * @wq: the waitqueue to wait on
878 * @condition: a C expression for the event to wait for
892 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
897 * change the result of the wait condition.
899 * The function will return -ERESTARTSYS if it was interrupted by a
911 * wait_event_killable - sleep until a condition gets true
912 * @wq_head: the waitqueue to wait on
913 * @condition: a C expression for the event to wait for
920 * change the result of the wait condition.
922 * The function will return -ERESTARTSYS if it was interrupted by a
934 #define __wait_event_state(wq, condition, state) \ argument
935 ___wait_event(wq, condition, state, 0, 0, schedule())
938 * wait_event_state - sleep until a condition gets true
939 * @wq_head: the waitqueue to wait on
940 * @condition: a C expression for the event to wait for
941 * @state: state to sleep in
943 * The process is put to sleep (@state) until the @condition evaluates to true
944 * or a signal is received (when allowed by @state). The @condition is checked
948 * change the result of the wait condition.
950 * The function will return -ERESTARTSYS if it was interrupted by a signal
951 * (when allowed by @state) and 0 if @condition evaluated to true.
953 #define wait_event_state(wq_head, condition, state) \ argument
958 __ret = __wait_event_state(wq_head, condition, state); \
968 * wait_event_killable_timeout - sleep until a condition gets true or a timeout elapses
969 * @wq_head: the waitqueue to wait on
970 * @condition: a C expression for the event to wait for
978 * change the result of the wait condition.
984 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
1008 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
1012 * @wq_head: the waitqueue to wait on
1013 * @condition: a C expression for the event to wait for
1024 * change the result of the wait condition.
1038 * wait_event_lock_irq - sleep until a condition gets true. The
1042 * @wq_head: the waitqueue to wait on
1043 * @condition: a C expression for the event to wait for
1052 * change the result of the wait condition.
1073 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
1076 * @wq_head: the waitqueue to wait on
1077 * @condition: a C expression for the event to wait for
1088 * change the result of the wait condition.
1094 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1107 * wait_event_interruptible_lock_irq - sleep until a condition gets true.
1110 * @wq_head: the waitqueue to wait on
1111 * @condition: a C expression for the event to wait for
1120 * change the result of the wait condition.
1125 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1137 #define __wait_event_lock_irq_timeout(wq_head, condition, lock, timeout, state) \ argument
1139 state, 0, timeout, \
1145 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
1148 * @wq_head: the waitqueue to wait on
1149 * @condition: a C expression for the event to wait for
1159 * change the result of the wait condition.
1164 * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
1192 void prepare_to_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1193 …e_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1194 …epare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1209 #define init_wait(wait) \ argument
1211 (wait)->private = current; \
1212 (wait)->func = autoremove_wake_function; \
1213 INIT_LIST_HEAD(&(wait)->entry); \
1214 (wait)->flags = 0; \