Helen Ma wrote:In my opinion, I think the answer should be sleep. The current thread will sleep and let other threads execute.
But why the answer is yield?
Anyone can help?
Hi Helen,
I thought that too. sleep should be the answer.
In K&B book it says "Using sleep() is the best way to help all threads get a chance to run! Or at least to guarantees that one thread doesn't get in and stay until it's done.
Can anyone help clarifying this?