Are Thread.sleep(0) and Thread.yield() statements equivalent?

Viewed 38802

Are these two statement equivalent?

Thread.sleep(0);
Thread.yield();
12 Answers

Thread.Sleep() has a slightly larger overhead because it creates a system that includes some kind of timer that will wake the process. (Depends on implementation basically)
Bottom line it will call a Yield() in the end.

Thread.Yield() Will just give-up the thread's turn, and gain it in the next round.

Thread.Sleep(0) might have an optimization to just call yield. (Again, implementation)

Related