diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-19 13:09:27 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-19 13:09:27 -0500 |
commit | 265952f112a27c8fbe47560b23a531f8baaf1898 (patch) | |
tree | 0a15f4313cdc368d58bff38e807b3531a4e79ffb /kernel | |
parent | 8ce9b0cb97d9266b3b64b2b57835e17f6e03f585 (diff) |
add complete_n() call to the completion API.
This is usefule for releasing exactly n tasks without having to
call compete() repeatedly.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 4890a12786..5d31bc9d56 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3895,6 +3895,18 @@ void complete_all(struct completion *x) | |||
3895 | } | 3895 | } |
3896 | EXPORT_SYMBOL(complete_all); | 3896 | EXPORT_SYMBOL(complete_all); |
3897 | 3897 | ||
3898 | void complete_n(struct completion *x, int n) | ||
3899 | { | ||
3900 | unsigned long flags; | ||
3901 | |||
3902 | spin_lock_irqsave(&x->wait.lock, flags); | ||
3903 | x->done += n; | ||
3904 | __wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, | ||
3905 | n, 0, NULL); | ||
3906 | spin_unlock_irqrestore(&x->wait.lock, flags); | ||
3907 | } | ||
3908 | EXPORT_SYMBOL(complete_n); | ||
3909 | |||
3898 | static inline long __sched | 3910 | static inline long __sched |
3899 | do_wait_for_common(struct completion *x, long timeout, int state) | 3911 | do_wait_for_common(struct completion *x, long timeout, int state) |
3900 | { | 3912 | { |