diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-12-07 19:05:16 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-12-08 12:44:51 -0500 |
commit | 735a96eeb485018d53ffb9548dacc8a9ab143582 (patch) | |
tree | cafcdb3966befbef3f8671214aa650f6eaffd6c8 | |
parent | 8e305c54a9f1ed0c0c181b40487aae13791b6e4f (diff) |
Add complete_n() call.
-rw-r--r-- | include/linux/completion.h | 2 | ||||
-rw-r--r-- | kernel/sched.c | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h index 33d6aaf94447..5b55e972be2c 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
@@ -51,7 +51,7 @@ extern unsigned long wait_for_completion_interruptible_timeout( | |||
51 | 51 | ||
52 | extern void complete(struct completion *); | 52 | extern void complete(struct completion *); |
53 | extern void complete_all(struct completion *); | 53 | extern void complete_all(struct completion *); |
54 | 54 | extern void complete_n(struct completion *, int n); | |
55 | #define INIT_COMPLETION(x) ((x).done = 0) | 55 | #define INIT_COMPLETION(x) ((x).done = 0) |
56 | 56 | ||
57 | #endif | 57 | #endif |
diff --git a/kernel/sched.c b/kernel/sched.c index 09b529cf2bd8..c7d7d535288a 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3923,6 +3923,18 @@ void complete_all(struct completion *x) | |||
3923 | } | 3923 | } |
3924 | EXPORT_SYMBOL(complete_all); | 3924 | EXPORT_SYMBOL(complete_all); |
3925 | 3925 | ||
3926 | void complete_n(struct completion *x, int n) | ||
3927 | { | ||
3928 | unsigned long flags; | ||
3929 | |||
3930 | spin_lock_irqsave(&x->wait.lock, flags); | ||
3931 | x->done += n; | ||
3932 | __wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, | ||
3933 | n, 0, NULL); | ||
3934 | spin_unlock_irqrestore(&x->wait.lock, flags); | ||
3935 | } | ||
3936 | EXPORT_SYMBOL(complete_n); | ||
3937 | |||
3926 | static inline long __sched | 3938 | static inline long __sched |
3927 | do_wait_for_common(struct completion *x, long timeout, int state) | 3939 | do_wait_for_common(struct completion *x, long timeout, int state) |
3928 | { | 3940 | { |