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()
246 #define ___wait_is_interruptible(state) \ argument
247 (!__builtin_constant_p(state) || \
248 state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
264 #define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \ argument
272 long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);\
277 if (___wait_is_interruptible(state) && __int) { \
293 * wait_event - sleep until a condition gets true
294 * @wq_head: the waitqueue to wait on
295 * @condition: a C expression for the event to wait for
302 * change the result of the wait condition.
317 * io_wait_event() -- like wait_event() but with io_schedule()
332 * wait_event_freezable - sleep (or freeze) until a condition gets true
333 * @wq_head: the waitqueue to wait on
334 * @condition: a C expression for the event to wait for
336 * The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
341 * change the result of the wait condition.
358 * wait_event_timeout - sleep until a condition gets true or a timeout elapses
359 * @wq_head: the waitqueue to wait on
360 * @condition: a C expression for the event to wait for
368 * change the result of the wait condition.
391 * like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
421 * wait_event_cmd - sleep until a condition gets true
422 * @wq_head: the waitqueue to wait on
423 * @condition: a C expression for the event to wait for
432 * change the result of the wait condition.
446 * wait_event_interruptible - sleep until a condition gets true
447 * @wq_head: the waitqueue to wait on
448 * @condition: a C expression for the event to wait for
455 * change the result of the wait condition.
457 * The function will return -ERESTARTSYS if it was interrupted by a
475 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
476 * @wq_head: the waitqueue to wait on
477 * @condition: a C expression for the event to wait for
485 * change the result of the wait condition.
491 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
504 #define __wait_event_hrtimeout(wq_head, condition, timeout, state) \ argument
513 current->timer_slack_ns, \
516 __ret = ___wait_event(wq_head, condition, state, 0, 0, \
518 __ret = -ETIME; \
529 * wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses
530 * @wq_head: the waitqueue to wait on
531 * @condition: a C expression for the event to wait for
539 * change the result of the wait condition.
541 * The function returns 0 if @condition became true, or -ETIME if the timeout
555 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
556 * @wq: the waitqueue to wait on
557 * @condition: a C expression for the event to wait for
565 * change the result of the wait condition.
567 * The function returns 0 if @condition became true, -ERESTARTSYS if it was
568 * interrupted by a signal, or -ETIME if the timeout elapsed.
621 * wait_event_idle - wait for a condition without contributing to system load
622 * @wq_head: the waitqueue to wait on
623 * @condition: a C expression for the event to wait for
630 * change the result of the wait condition.
641 * wait_event_idle_exclusive - wait for a condition with contributing to system load
642 * @wq_head: the waitqueue to wait on
643 * @condition: a C expression for the event to wait for
649 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
650 * set thus if other processes wait on the same list, when this
654 * change the result of the wait condition.
670 * wait_event_idle_timeout - sleep without load until a condition becomes true or a timeout elapses
671 * @wq_head: the waitqueue to wait on
672 * @condition: a C expression for the event to wait for
680 * change the result of the wait condition.
703 …* wait_event_idle_exclusive_timeout - sleep without load until a condition becomes true or a timeo…
704 * @wq_head: the waitqueue to wait on
705 * @condition: a C expression for the event to wait for
712 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
713 * set thus if other processes wait on the same list, when this
717 * change the result of the wait condition.
755 * wait_event_interruptible_locked - sleep until a condition gets true
756 * @wq: the waitqueue to wait on
757 * @condition: a C expression for the event to wait for
772 * change the result of the wait condition.
774 * The function will return -ERESTARTSYS if it was interrupted by a
782 * wait_event_interruptible_locked_irq - 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_exclusive_locked - sleep exclusively until a condition gets true
810 * @wq: the waitqueue to wait on
811 * @condition: a C expression for the event to wait for
825 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
830 * change the result of the wait condition.
832 * The function will return -ERESTARTSYS if it was interrupted by a
840 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
841 * @wq: the waitqueue to wait on
842 * @condition: a C expression for the event to wait for
856 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
861 * change the result of the wait condition.
863 * The function will return -ERESTARTSYS if it was interrupted by a
875 * wait_event_killable - sleep until a condition gets true
876 * @wq_head: the waitqueue to wait on
877 * @condition: a C expression for the event to wait for
884 * change the result of the wait condition.
886 * The function will return -ERESTARTSYS if it was interrupted by a
904 * wait_event_killable_timeout - sleep until a condition gets true or a timeout elapses
905 * @wq_head: the waitqueue to wait on
906 * @condition: a C expression for the event to wait for
914 * change the result of the wait condition.
920 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
944 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
948 * @wq_head: the waitqueue to wait on
949 * @condition: a C expression for the event to wait for
960 * change the result of the wait condition.
974 * wait_event_lock_irq - sleep until a condition gets true. The
978 * @wq_head: the waitqueue to wait on
979 * @condition: a C expression for the event to wait for
988 * change the result of the wait condition.
1009 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
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.
1030 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1043 * wait_event_interruptible_lock_irq - sleep until a condition gets true.
1046 * @wq_head: the waitqueue to wait on
1047 * @condition: a C expression for the event to wait for
1056 * change the result of the wait condition.
1061 * The macro will return -ERESTARTSYS if it was interrupted by a signal
1073 #define __wait_event_lock_irq_timeout(wq_head, condition, lock, timeout, state) \ argument
1075 state, 0, timeout, \
1081 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
1084 * @wq_head: the waitqueue to wait on
1085 * @condition: a C expression for the event to wait for
1095 * change the result of the wait condition.
1100 * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
1128 void prepare_to_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1129 …e_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1130 …epare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state);
1145 #define init_wait(wait) \ argument
1147 (wait)->private = current; \
1148 (wait)->func = autoremove_wake_function; \
1149 INIT_LIST_HEAD(&(wait)->entry); \
1150 (wait)->flags = 0; \