Commit 58aa897f authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md 7 of 22 - Use wait_event_interuptible in md_thread

It currently has several lines of code where one will do.
parent 26d2d542
...@@ -2929,17 +2929,10 @@ int md_thread(void * arg) ...@@ -2929,17 +2929,10 @@ int md_thread(void * arg)
complete(thread->event); complete(thread->event);
while (thread->run) { while (thread->run) {
void (*run)(void *data); void (*run)(void *data);
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&thread->wqueue, &wait); wait_event_interruptible(thread->wqueue,
set_task_state(current, TASK_INTERRUPTIBLE); test_bit(THREAD_WAKEUP, &thread->flags));
if (!test_bit(THREAD_WAKEUP, &thread->flags)) {
dprintk("md: thread %p went to sleep.\n", thread);
schedule();
dprintk("md: thread %p woke up.\n", thread);
}
current->state = TASK_RUNNING;
remove_wait_queue(&thread->wqueue, &wait);
clear_bit(THREAD_WAKEUP, &thread->flags); clear_bit(THREAD_WAKEUP, &thread->flags);
run = thread->run; run = thread->run;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment