diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-12-06 12:29:54 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@linux.intel.com> | 2007-12-06 17:40:19 -0500 |
commit | 009e577e079656d51d0fe9b15e61e41b00816c29 (patch) | |
tree | bc0f1ac69dae6c845f1d02b710bf9073a7d8616a /kernel/sched.c | |
parent | 1411d5a7fbe7dce1568b6f0a94c7cbc69eed1bfe (diff) | |
download | op-kernel-dev-009e577e079656d51d0fe9b15e61e41b00816c29.zip op-kernel-dev-009e577e079656d51d0fe9b15e61e41b00816c29.tar.gz |
Add wait_for_completion_killable
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 15 |
1 files changed, 13 insertions, 2 deletions
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) { |