Putting a thread to sleep using schedule() is foolproof?

Joshi joshiiitr at gmail.com
Wed Jun 11 13:39:05 EDT 2014


Yes, there are other ways, but I have a doubt on one of the basic method of
sleeping -

set_current_state (TASK_INTERRUPTIBLE);
schedule ();

Is this a sure-shot way of putting a thread to sleep, or are there
conditions when this may not put the calling thread into sleep?

Almost always I see that the thread goes to sleep, until explicitly woken
up by another thread. But, once it a blue moon, I find that thread executes
the above instructions and does not go to sleep!

-- 
Joshi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140611/33cd22f1/attachment.html 


More information about the Kernelnewbies mailing list