Hi listmembers,
there was a request to explain how to get away from sleep_on and relatives.
Here is my attempt to summarise it.
Number1
old:
if (test)
sleep_on_interruptible(&desc->queue);
new:
DECLARE_WAITQUEUE(wait, current);
..........
add_wait_queue(&desc->queue, &wait);
set_current_state(TASK_INTERRUPTIBLE);
if (test)
schedule();
remove_wait_queue(&desc->queue, &wait);
set_current_state(TASK_RUNNING);
if (signal_pending(current)) {
//deal with it, but keep in mind that the urb may be completed nevertheless
}
Number2:
old:
start_something_that_we_will_wait_for();
sleep_on_interruptible(&desc->queue);
new:
DECLARE_WAITQUEUE(wait, current);
.......................
add_wait_queue(&desc->queue, &wait);
set_current_state(TASK_INTERRUPTIBLE);
start_something_that_we_will_wait_for();
schedule();
remove_wait_queue(&desc->queue, &wait);
set_current_state(TASK_RUNNING);
if (signal_pending(current)) {
//deal with it, but keep in mind that the urb may be completed nevertheless
}
Of course you must not sleep in start_something_that_we_will_wait_for(); , or
you are screwed.
I hope this patterns are useful.
Regards
Oliver
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel