diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-08-25 05:04:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-08-25 05:04:51 -0400 |
commit | 10c9850cb2ced2ce528e5b692c639974213a64ec (patch) | |
tree | f8063beac0ba1dab069d25661845c5b7ef9a67c7 /include/linux/wait.h | |
parent | 0c2364791343e4b04cd1f097ff2abc2799062448 (diff) | |
parent | 90a6cd503982bfd33ce8c70eb49bd2dd33bc6325 (diff) |
Merge branch 'linus' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r-- | include/linux/wait.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index 5b74e36c0ca8..dc19880c02f5 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -757,6 +757,43 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); | |||
757 | __ret; \ | 757 | __ret; \ |
758 | }) | 758 | }) |
759 | 759 | ||
760 | #define __wait_event_killable_timeout(wq_head, condition, timeout) \ | ||
761 | ___wait_event(wq_head, ___wait_cond_timeout(condition), \ | ||
762 | TASK_KILLABLE, 0, timeout, \ | ||
763 | __ret = schedule_timeout(__ret)) | ||
764 | |||
765 | /** | ||
766 | * wait_event_killable_timeout - sleep until a condition gets true or a timeout elapses | ||
767 | * @wq_head: the waitqueue to wait on | ||
768 | * @condition: a C expression for the event to wait for | ||
769 | * @timeout: timeout, in jiffies | ||
770 | * | ||
771 | * The process is put to sleep (TASK_KILLABLE) until the | ||
772 | * @condition evaluates to true or a kill signal is received. | ||
773 | * The @condition is checked each time the waitqueue @wq_head is woken up. | ||
774 | * | ||
775 | * wake_up() has to be called after changing any variable that could | ||
776 | * change the result of the wait condition. | ||
777 | * | ||
778 | * Returns: | ||
779 | * 0 if the @condition evaluated to %false after the @timeout elapsed, | ||
780 | * 1 if the @condition evaluated to %true after the @timeout elapsed, | ||
781 | * the remaining jiffies (at least 1) if the @condition evaluated | ||
782 | * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was | ||
783 | * interrupted by a kill signal. | ||
784 | * | ||
785 | * Only kill signals interrupt this process. | ||
786 | */ | ||
787 | #define wait_event_killable_timeout(wq_head, condition, timeout) \ | ||
788 | ({ \ | ||
789 | long __ret = timeout; \ | ||
790 | might_sleep(); \ | ||
791 | if (!___wait_cond_timeout(condition)) \ | ||
792 | __ret = __wait_event_killable_timeout(wq_head, \ | ||
793 | condition, timeout); \ | ||
794 | __ret; \ | ||
795 | }) | ||
796 | |||
760 | 797 | ||
761 | #define __wait_event_lock_irq(wq_head, condition, lock, cmd) \ | 798 | #define __wait_event_lock_irq(wq_head, condition, lock, cmd) \ |
762 | (void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \ | 799 | (void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \ |