Hi,
I'm somewhat confused about yield(). I know this question might have appeared here earlier. 1.4
thread API says:
"public static void yield()Causes the currently executing thread object to temporarily pause and allow other threads to execute."
This means that it will definetely go into runnable state from the running state. However an earlier discussion over here says that it is just a hint to the jvm that it may schedule other threads if it wants.
Also, I have read somewherer (don't remember where) that the thread goes into the runnable state and then jvm looks at the priorities of the thread already waiting there and then picks the thread for execution. So how I interpret this is that at least for once the running thread will go into runnable state and may come back again to running state immediately if there are no other threads with higher priority but that is indeterminate i.e. jvm dependent. However one thing is for sure that the thread will defintely pause for a moment i.e. goes to runnable state.
Am I right?
Java Gurus, your input would really help.
Thanks,
Deep