Hi All,
Please look at the following code from the article Sleeping in the Kernel
http://www.linuxjournal.com/node/8144/print
1 set_current_state(TASK_INTERRUPTIBLE);
2 spin_lock(&list_lock);
3 if(list_empty(&list_head)) {
4 spin_unlock(&list_lock);
5 schedule();
6 spin_lock(&list_lock);
7 }
8 set_current_state(TASK_RUNNING);
9
10 /* Rest of the code ... */
11 spin_unlock(&list_lock);
Is there any chance for the process getting scheduled out of the run-queue at Line# 2 (say the scheduler runs because of timer interrupt)?? If so, the process won't be scheduled again. Right? If so, what is the best solution for preventing that?
Thanks,
Sudheer