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