Gitweb:
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=009e577e079656d51d0fe9b15e61e41b00816c29
Commit: 009e577e079656d51d0fe9b15e61e41b00816c29
Parent: 1411d5a7fbe7dce1568b6f0a94c7cbc69eed1bfe
Author: Matthew Wilcox <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 6 12:29:54 2007 -0500
Committer: Matthew Wilcox <[EMAIL PROTECTED]>
CommitDate: Thu Dec 6 17:40:19 2007 -0500
Add wait_for_completion_killable
Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]>
---
include/linux/completion.h | 1 +
kernel/sched.c | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 33d6aaf..d2961b6 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -44,6 +44,7 @@ static inline void init_completion(struct completion *x)
extern void wait_for_completion(struct completion *);
extern int wait_for_completion_interruptible(struct completion *x);
+extern int wait_for_completion_killable(struct completion *x);
extern unsigned long wait_for_completion_timeout(struct completion *x,
unsigned long timeout);
extern unsigned long wait_for_completion_interruptible_timeout(
diff --git a/kernel/sched.c b/kernel/sched.c
index 50a0faa..d2f77fa 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3881,8 +3881,10 @@ do_wait_for_common(struct completion *x, long timeout,
int state)
wait.flags |= WQ_FLAG_EXCLUSIVE;
__add_wait_queue_tail(&x->wait, &wait);
do {
- if (state == TASK_INTERRUPTIBLE &&
- signal_pending(current)) {
+ if ((state == TASK_INTERRUPTIBLE &&
+ signal_pending(current)) ||
+ (state == TASK_KILLABLE &&
+ fatal_signal_pending(current))) {
__remove_wait_queue(&x->wait, &wait);
return -ERESTARTSYS;
}
@@ -3942,6 +3944,15 @@ wait_for_completion_interruptible_timeout(struct
completion *x,
}
EXPORT_SYMBOL(wait_for_completion_interruptible_timeout);
+int __sched wait_for_completion_killable(struct completion *x)
+{
+ long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE);
+ if (t == -ERESTARTSYS)
+ return t;
+ return 0;
+}
+EXPORT_SYMBOL(wait_for_completion_killable);
+
static long __sched
sleep_on_common(wait_queue_head_t *q, int state, long timeout)
{
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html