• Home
  • Raw
  • Download

Lines Matching +full:wait +full:- +full:state

1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Linux wait queue related types and methods
12 #include <uapi/linux/wait.h>
27 * A single wait-queue entry structure:
83 wq_entry->flags = 0; in init_waitqueue_entry()
84 wq_entry->private = p; in init_waitqueue_entry()
85 wq_entry->func = default_wake_function; in init_waitqueue_entry()
91 wq_entry->flags = 0; in init_waitqueue_func_entry()
92 wq_entry->private = NULL; in init_waitqueue_func_entry()
93 wq_entry->func = func; in init_waitqueue_func_entry()
97 * waitqueue_active -- locklessly test for waiters on the queue
100 * returns true if the wait list is not empty
103 * lead to sporadic and non-obvious failure.
108 * CPU0 - waker CPU1 - waiter
111 * @cond = true; prepare_to_wait(&wq_head, &wait, state);
117 * finish_wait(&wq_head, &wait);
121 * observe an empty wait list while the waiter might not observe @cond.
128 return !list_empty(&wq_head->head); in waitqueue_active()
132 * wq_has_single_sleeper - check if there is only one sleeper
133 * @wq_head: wait queue head
141 return list_is_singular(&wq_head->head); in wq_has_single_sleeper()
145 * wq_has_sleeper - check if there are any waiting processes
146 * @wq_head: wait queue head
156 * add_wait_queue modifications to the wait queue. in wq_has_sleeper()
171 list_add(&wq_entry->entry, &wq_head->head); in __add_wait_queue()
175 * Used for wake-one threads:
180 wq_entry->flags |= WQ_FLAG_EXCLUSIVE; in __add_wait_queue_exclusive()
186 list_add_tail(&wq_entry->entry, &wq_head->head); in __add_wait_queue_entry_tail()
192 wq_entry->flags |= WQ_FLAG_EXCLUSIVE; in __add_wait_queue_entry_tail_exclusive()
199 list_del(&wq_entry->entry); in __remove_wait_queue()
240 * wake_up_pollfree - signal that a polled waitqueue is going away
241 * @wq_head: the wait queue head
243 * In the very rare cases where a ->poll() implementation uses a waitqueue whose
246 * non-blocking polls (e.g. epoll) are notified that the queue is going away.
248 * The caller must also RCU-delay the freeing of the wait_queue_head, e.g. via
258 * can safely proceed with an RCU-delayed free. in wake_up_pollfree()
272 #define ___wait_is_interruptible(state) \ argument
273 (!__builtin_constant_p(state) || \
274 state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
290 #define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \ argument
298 long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);\
303 if (___wait_is_interruptible(state) && __int) { \
319 * wait_event - sleep until a condition gets true
320 * @wq_head: the waitqueue to wait on
321 * @condition: a C expression for the event to wait for
328 * change the result of the wait condition.
343 * io_wait_event() -- like wait_event() but with io_schedule()
358 * wait_event_freezable - sleep (or freeze) until a condition gets true
359 * @wq_head: the waitqueue to wait on
360 * @condition: a C expression for the event to wait for
362 * The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
367 * change the result of the wait condition.
384 * wait_event_timeout - sleep until a condition gets true or a timeout elapses
385 * @wq_head: the waitqueue to wait on
386 * @condition: a C expression for the event to wait for
394 * change the result of the wait condition.
417 * like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
447 * wait_event_cmd - sleep until a condition gets true
448 * @wq_head: the waitqueue to wait on
449 * @condition: a C expression for the event to wait for
458 * change the result of the wait condition.
472 * wait_event_interruptible - sleep until a condition gets true
473 * @wq_head: the waitqueue to wait on
474 * @condition: a C expression for the event to wait for
481 * change the result of the wait condition.
483 * The function will return -ERESTARTSYS if it was interrupted by a
501 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
502 * @wq_head: the waitqueue to wait on
503 * @condition: a C expression for the event to wait for
511 * change the result of the wait condition.
517 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
530 #define __wait_event_hrtimeout(wq_head, condition, timeout, state) \ argument
539 current->timer_slack_ns); \
543 __ret = ___wait_event(wq_head, condition, state, 0, 0, \
545 __ret = -ETIME; \
556 * wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses
557 * @wq_head: the waitqueue to wait on
558 * @condition: a C expression for the event to wait for
566 * change the result of the wait condition.
568 * The function returns 0 if @condition became true, or -ETIME if the timeout
582 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
583 * @wq: the waitqueue to wait on
584 * @condition: a C expression for the event to wait for
592 * change the result of the wait condition.
594 * The function returns 0 if @condition became true, -ERESTARTSYS if it was
595 * interrupted by a signal, or -ETIME if the timeout elapsed.
648 * wait_event_idle - wait for a condition without contributing to system load
649 * @wq_head: the waitqueue to wait on
650 * @condition: a C expression for the event to wait for
657 * change the result of the wait condition.
668 * wait_event_idle_exclusive - wait for a condition with contributing to system load
669 * @wq_head: the waitqueue to wait on
670 * @condition: a C expression for the event to wait for
676 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
677 * set thus if other processes wait on the same list, when this
681 * change the result of the wait condition.
697 * wait_event_idle_timeout - sleep without load until a condition becomes true or a timeout elapses
698 * @wq_head: the waitqueue to wait on
699 * @condition: a C expression for the event to wait for
707 * change the result of the wait condition.
730 …* wait_event_idle_exclusive_timeout - sleep without load until a condition becomes true or a timeo…
731 * @wq_head: the waitqueue to wait on
732 * @condition: a C expression for the event to wait for
739 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
740 * set thus if other processes wait on the same list, when this
744 * change the result of the wait condition.
782 * wait_event_interruptible_locked - sleep until a condition gets true
783 * @wq: the waitqueue to wait on
784 * @condition: a C expression for the event to wait for
799 * change the result of the wait condition.
801 * The function will return -ERESTARTSYS if it was interrupted by a
809 * wait_event_interruptible_locked_irq - sleep until a condition gets true
810 * @wq: the waitqueue to wait on
811 * @condition: a C expression for the event to wait for
826 * change the result of the wait condition.
828 * The function will return -ERESTARTSYS if it was interrupted by a
836 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
837 * @wq: the waitqueue to wait on
838 * @condition: a C expression for the event to wait for
852 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
857 * change the result of the wait condition.
859 * The function will return -ERESTARTSYS if it was interrupted by a
867 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
868 * @wq: the waitqueue to wait on
869 * @condition: a C expression for the event to wait for
883 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
888 * change the result of the wait condition.
890 * The function will return -ERESTARTSYS if it was interrupted by a
902 * wait_event_killable - sleep until a condition gets true
903 * @wq_head: the waitqueue to wait on
904 * @condition: a C expression for the event to wait for
911 * change the result of the wait condition.
913 * The function will return -ERESTARTSYS if it was interrupted by a
931 * wait_event_killable_timeout - sleep until a condition gets true or a timeout elapses
932 * @wq_head: the waitqueue to wait on
933 * @condition: a C expression for the event to wait for
941 * change the result of the wait condition.
947 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
971 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
975 * @wq_head: the waitqueue to wait on
976 * @condition: a C expression for the event to wait for
987 * change the result of the wait condition.
1001 * wait_event_lock_irq - sleep until a condition gets true. The
1005 * @wq_head: the waitqueue to wait on
1006 * @condition: a C expression for the event to wait for
1015 * change the result of the wait condition.
1036 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
1039 * @wq_head: the waitqueue to wait on
1040 * @condition: a C expression for the event to wait for
1051 * change the result of the wait condition.
1057 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1070 * wait_event_interruptible_lock_irq - sleep until a condition gets true.
1073 * @wq_head: the waitqueue to wait on
1074 * @condition: a C expression for the event to wait for
1083 * change the result of the wait condition.
1088 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1100 #define __wait_event_lock_irq_timeout(wq_head, condition, lock, timeout, state) \ argument
1102 state, 0, timeout, \
1108 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
1111 * @wq_head: the waitqueue to wait on
1112 * @condition: a C expression for the event to wait for
1122 * change the result of the wait condition.
1127 * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
1155 void prepare_to_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1156 …e_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1157 …epare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1172 #define init_wait(wait) \ argument
1174 (wait)->private = current; \
1175 (wait)->func = autoremove_wake_function; \
1176 INIT_LIST_HEAD(&(wait)->entry); \
1177 (wait)->flags = 0; \