It's a good point about using yield(). I did use this originally,
but
for some reason it generated fewer errors than using some arbitrary
sleep values.
From discussions or reading I did years back I vaguely recall, yield()
isn't required to do anything.
If the VM/OS observes that the same thread that
called yield() is still eligible to run, it is quite likely to simply reschedule it as the
best candidate.
Depending on the level in the code where this happens in a particular VM or OS
implementation, yield() can therefore be a no-op, or a very short break.
sleep() on the other hand makes the thread ineligible to run for a period, forcing a
context switch to always happen.
--
Andrew Thompson
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091