I know one difference:
If we say thread.sleep(1000)
, that thread will sleep for 1000
milliseconds for sure, whereas with yield()
there is no such guarantee. This is useful for thread scheduling, since the thread which calls yield()
may very well selected immediately again for running.
What else?