diff options
| author | J. Bruce Fields <bfields@redhat.com> | 2011-10-06 15:22:46 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2011-11-14 06:50:37 -0500 |
| commit | c6dc7f055d333ef35f397b8d7c3abcd1918bf8cb (patch) | |
| tree | c4edc4a84ba9636057d923a308e2a3bcd910fa63 /kernel | |
| parent | 461819ac8ee950ce027c72a066156a3df9e60c7e (diff) | |
sched: Document wait_for_completion_*() return values
The return-value convention for these functions varies depending on
whether they're interruptible or can timeout. It can be a little
confusing--document it.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20111006192246.GB28026@fieldses.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 0e9344a71be3..3d2c436959a1 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -4810,6 +4810,9 @@ EXPORT_SYMBOL(wait_for_completion); | |||
| 4810 | * This waits for either a completion of a specific task to be signaled or for a | 4810 | * This waits for either a completion of a specific task to be signaled or for a |
| 4811 | * specified timeout to expire. The timeout is in jiffies. It is not | 4811 | * specified timeout to expire. The timeout is in jiffies. It is not |
| 4812 | * interruptible. | 4812 | * interruptible. |
| 4813 | * | ||
| 4814 | * The return value is 0 if timed out, and positive (at least 1, or number of | ||
| 4815 | * jiffies left till timeout) if completed. | ||
| 4813 | */ | 4816 | */ |
| 4814 | unsigned long __sched | 4817 | unsigned long __sched |
| 4815 | wait_for_completion_timeout(struct completion *x, unsigned long timeout) | 4818 | wait_for_completion_timeout(struct completion *x, unsigned long timeout) |
| @@ -4824,6 +4827,8 @@ EXPORT_SYMBOL(wait_for_completion_timeout); | |||
| 4824 | * | 4827 | * |
| 4825 | * This waits for completion of a specific task to be signaled. It is | 4828 | * This waits for completion of a specific task to be signaled. It is |
| 4826 | * interruptible. | 4829 | * interruptible. |
| 4830 | * | ||
| 4831 | * The return value is -ERESTARTSYS if interrupted, 0 if completed. | ||
| 4827 | */ | 4832 | */ |
| 4828 | int __sched wait_for_completion_interruptible(struct completion *x) | 4833 | int __sched wait_for_completion_interruptible(struct completion *x) |
| 4829 | { | 4834 | { |
| @@ -4841,6 +4846,9 @@ EXPORT_SYMBOL(wait_for_completion_interruptible); | |||
| 4841 | * | 4846 | * |
| 4842 | * This waits for either a completion of a specific task to be signaled or for a | 4847 | * This waits for either a completion of a specific task to be signaled or for a |
| 4843 | * specified timeout to expire. It is interruptible. The timeout is in jiffies. | 4848 | * specified timeout to expire. It is interruptible. The timeout is in jiffies. |
| 4849 | * | ||
| 4850 | * The return value is -ERESTARTSYS if interrupted, 0 if timed out, | ||
| 4851 | * positive (at least 1, or number of jiffies left till timeout) if completed. | ||
| 4844 | */ | 4852 | */ |
| 4845 | long __sched | 4853 | long __sched |
| 4846 | wait_for_completion_interruptible_timeout(struct completion *x, | 4854 | wait_for_completion_interruptible_timeout(struct completion *x, |
| @@ -4856,6 +4864,8 @@ EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); | |||
| 4856 | * | 4864 | * |
| 4857 | * This waits to be signaled for completion of a specific task. It can be | 4865 | * This waits to be signaled for completion of a specific task. It can be |
| 4858 | * interrupted by a kill signal. | 4866 | * interrupted by a kill signal. |
| 4867 | * | ||
| 4868 | * The return value is -ERESTARTSYS if interrupted, 0 if completed. | ||
| 4859 | */ | 4869 | */ |
| 4860 | int __sched wait_for_completion_killable(struct completion *x) | 4870 | int __sched wait_for_completion_killable(struct completion *x) |
| 4861 | { | 4871 | { |
| @@ -4874,6 +4884,9 @@ EXPORT_SYMBOL(wait_for_completion_killable); | |||
| 4874 | * This waits for either a completion of a specific task to be | 4884 | * This waits for either a completion of a specific task to be |
| 4875 | * signaled or for a specified timeout to expire. It can be | 4885 | * signaled or for a specified timeout to expire. It can be |
| 4876 | * interrupted by a kill signal. The timeout is in jiffies. | 4886 | * interrupted by a kill signal. The timeout is in jiffies. |
| 4887 | * | ||
| 4888 | * The return value is -ERESTARTSYS if interrupted, 0 if timed out, | ||
| 4889 | * positive (at least 1, or number of jiffies left till timeout) if completed. | ||
| 4877 | */ | 4890 | */ |
| 4878 | long __sched | 4891 | long __sched |
| 4879 | wait_for_completion_killable_timeout(struct completion *x, | 4892 | wait_for_completion_killable_timeout(struct completion *x, |
