This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
[Lave]: Yield relinquish the CPU but sleep does not.
Where did you get this idea? That's not even remotely true. Either method may relinquish the CPU, while neither is required to. The sleep() method is more likely to relinquish the CPU, because it generally has a minimum time span during which it cannot resume control of the CPU. Unless you're calling sleep(0), which is generally equivalent to yield().
"I'm not back." - Bill Harding, Twister
Joined: Oct 21, 2007
In one of my java projects it happend, the sleep was consuming CPU continuosly, so I used yield along with sleep to get rid of this problem.
Originally posted by Jim Yingst: [QB][Lave]: Yield relinquish the CPU but sleep does not.