That's possible, but it will crash on Sparc: you cannot restore the
interrupt flag saved in one function in another function.
The solution is very simple: do not call restore_flags() before
interruptible_sleep_on(), the schedule internally reenables interrupts.
>>>>>>>>>>
for(;;) {
cli();
if(condition) {
sti();
break;
}
interruptible_sleep_on();
sti(); /* required! */
}
>>>>>>>>>
But if you are writing new code, then DO NOT USE sleep_on(), use
add_wait_queue(), and a spinlock instead of cli().
Look at wait_event_irq in <linux/raid/md_k.h> from the 2.4 kernel as an
example.
-- Manfred - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/