Re: Problems writting a CHAR Driver with interruptible_sleep (wait_queu e)

Russell King (rmk@arm.linux.org.uk)
Sat, 14 Aug 1999 15:05:44 +0100 (BST)


Benjamin LaHaise writes:
> current->state = TASK_INTERRUPTIBLE;
> add_wait_queue(&my_wait_queue, &wait);

That should be:
add_wait_queue(&my_wait_queue, &wait);
current->state = TASK_INTERRUPTIBLE;

otherwise there is a chance that the interrupt could occur between
the TASK_INTERRUPTIBLE and the add_wait_queue. If this does happen,
the task will not be on my_wait_queue, and therefore the state will
not be set to TASK_RUNNING.
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King rmk@arm.linux.org.uk --- ---
| | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/