More accurate wording for java.util.concurrent.TimeUnit.sleep

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

More accurate wording for java.util.concurrent.TimeUnit.sleep

JSR166 Concurrency mailing list
While reading the javadoc for the java.util.concurrent.TimeUnit.sleep
method I noticed an inconsistency.

"...@param timeout the minimum time to sleep. If less than or equal to
zero, do not sleep at all..."

I'd argue that the use of the word "minimum" there might be
misleading. Thread.sleep (which TimeUnit.sleep claims to delegate the
sleeping to) does not give that guarantee. It simply states

"...@param millis the length of time to sleep in milliseconds..."

Moreover, the spec for Thread.sleep has a special clause that suggests
that the thread may sleep inaccurately, possibly even less than the
specified amount of time:

"...subject to the precision and accuracy of system timers and schedulers..."

Thanks,
-Pavel
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest