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()
241 * wake_up_pollfree - signal that a polled waitqueue is going away
242 * @wq_head: the wait queue head
244 * In the very rare cases where a ->poll() implementation uses a waitqueue whose
247 * non-blocking polls (e.g. epoll) are notified that the queue is going away.
249 * The caller must also RCU-delay the freeing of the wait_queue_head, e.g. via
259 * can safely proceed with an RCU-delayed free. in wake_up_pollfree()
273 #define ___wait_is_interruptible(state) \ argument
274 (!__builtin_constant_p(state) || \
275 state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
291 #define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \ argument
299 long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);\
304 if (___wait_is_interruptible(state) && __int) { \
320 * wait_event - sleep until a condition gets true
321 * @wq_head: the waitqueue to wait on
322 * @condition: a C expression for the event to wait for
329 * change the result of the wait condition.
344 * io_wait_event() -- like wait_event() but with io_schedule()
359 * wait_event_freezable - sleep (or freeze) until a condition gets true
360 * @wq_head: the waitqueue to wait on
361 * @condition: a C expression for the event to wait for
363 * The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
368 * change the result of the wait condition.
385 * wait_event_timeout - sleep until a condition gets true or a timeout elapses
386 * @wq_head: the waitqueue to wait on
387 * @condition: a C expression for the event to wait for
395 * change the result of the wait condition.
418 * like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
448 * wait_event_cmd - sleep until a condition gets true
449 * @wq_head: the waitqueue to wait on
450 * @condition: a C expression for the event to wait for
459 * change the result of the wait condition.
473 * wait_event_interruptible - sleep until a condition gets true
474 * @wq_head: the waitqueue to wait on
475 * @condition: a C expression for the event to wait for
482 * change the result of the wait condition.
484 * The function will return -ERESTARTSYS if it was interrupted by a
502 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
503 * @wq_head: the waitqueue to wait on
504 * @condition: a C expression for the event to wait for
512 * change the result of the wait condition.
518 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
531 #define __wait_event_hrtimeout(wq_head, condition, timeout, state) \ argument
540 current->timer_slack_ns); \
544 __ret = ___wait_event(wq_head, condition, state, 0, 0, \
546 __ret = -ETIME; \
557 * wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses
558 * @wq_head: the waitqueue to wait on
559 * @condition: a C expression for the event to wait for
567 * change the result of the wait condition.
569 * The function returns 0 if @condition became true, or -ETIME if the timeout
583 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
584 * @wq: the waitqueue to wait on
585 * @condition: a C expression for the event to wait for
593 * change the result of the wait condition.
595 * The function returns 0 if @condition became true, -ERESTARTSYS if it was
596 * interrupted by a signal, or -ETIME if the timeout elapsed.
649 * wait_event_idle - wait for a condition without contributing to system load
650 * @wq_head: the waitqueue to wait on
651 * @condition: a C expression for the event to wait for
658 * change the result of the wait condition.
669 * wait_event_idle_exclusive - wait for a condition with contributing to system load
670 * @wq_head: the waitqueue to wait on
671 * @condition: a C expression for the event to wait for
677 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
678 * set thus if other processes wait on the same list, when this
682 * change the result of the wait condition.
698 * wait_event_idle_timeout - sleep without load until a condition becomes true or a timeout elapses
699 * @wq_head: the waitqueue to wait on
700 * @condition: a C expression for the event to wait for
708 * change the result of the wait condition.
731 …* wait_event_idle_exclusive_timeout - sleep without load until a condition becomes true or a timeo…
732 * @wq_head: the waitqueue to wait on
733 * @condition: a C expression for the event to wait for
740 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
741 * set thus if other processes wait on the same list, when this
745 * change the result of the wait condition.
783 * wait_event_interruptible_locked - sleep until a condition gets true
784 * @wq: the waitqueue to wait on
785 * @condition: a C expression for the event to wait for
800 * change the result of the wait condition.
802 * The function will return -ERESTARTSYS if it was interrupted by a
810 * wait_event_interruptible_locked_irq - sleep until a condition gets true
811 * @wq: the waitqueue to wait on
812 * @condition: a C expression for the event to wait for
827 * change the result of the wait condition.
829 * The function will return -ERESTARTSYS if it was interrupted by a
837 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
838 * @wq: the waitqueue to wait on
839 * @condition: a C expression for the event to wait for
853 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
858 * change the result of the wait condition.
860 * The function will return -ERESTARTSYS if it was interrupted by a
868 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
869 * @wq: the waitqueue to wait on
870 * @condition: a C expression for the event to wait for
884 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
889 * change the result of the wait condition.
891 * The function will return -ERESTARTSYS if it was interrupted by a
903 * wait_event_killable - sleep until a condition gets true
904 * @wq_head: the waitqueue to wait on
905 * @condition: a C expression for the event to wait for
912 * change the result of the wait condition.
914 * The function will return -ERESTARTSYS if it was interrupted by a
932 * wait_event_killable_timeout - sleep until a condition gets true or a timeout elapses
933 * @wq_head: the waitqueue to wait on
934 * @condition: a C expression for the event to wait for
942 * change the result of the wait condition.
948 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
972 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
976 * @wq_head: the waitqueue to wait on
977 * @condition: a C expression for the event to wait for
988 * change the result of the wait condition.
1002 * wait_event_lock_irq - sleep until a condition gets true. The
1006 * @wq_head: the waitqueue to wait on
1007 * @condition: a C expression for the event to wait for
1016 * change the result of the wait condition.
1037 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
1040 * @wq_head: the waitqueue to wait on
1041 * @condition: a C expression for the event to wait for
1052 * change the result of the wait condition.
1058 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1071 * wait_event_interruptible_lock_irq - sleep until a condition gets true.
1074 * @wq_head: the waitqueue to wait on
1075 * @condition: a C expression for the event to wait for
1084 * change the result of the wait condition.
1089 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1101 #define __wait_event_lock_irq_timeout(wq_head, condition, lock, timeout, state) \ argument
1103 state, 0, timeout, \
1109 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
1112 * @wq_head: the waitqueue to wait on
1113 * @condition: a C expression for the event to wait for
1123 * change the result of the wait condition.
1128 * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
1156 void prepare_to_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1157 …e_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1158 …epare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1173 #define init_wait(wait) \ argument
1175 (wait)->private = current; \
1176 (wait)->func = autoremove_wake_function; \
1177 INIT_LIST_HEAD(&(wait)->entry); \
1178 (wait)->flags = 0; \