RFR(s) #2: 6344935: (spec) clarify specifications for Object.wait overloads
martinrb at google.com
Sat Aug 19 20:37:10 UTC 2017
377 * <li>The specified amount of real time has elapsed, more or less.
* <li>At least the specified amount of real time has elapsed.
(I think I failed to persuade David last time ...)
We should add a @see to TimeUnit.timedWait which at least deals with
What percentage of the jdk's wait loops are actually correct?
Especially if you throw in the requirement to only call System.nanoTime
after checking the condition the first time.
Wait loops should probably not call currentTimeMillis.
Writing a good timed wait loop is surprisingly tricky.
Condition.awaitNanos helps by returning the updated time to wait. See our
competing code snippet:
Maybe the code snippet should use the plain millis form, since the excess
nanos are pretty much useless this decade.
More information about the core-libs-dev