The advantage is the simple logic in `#wait`.

The alternative is the 1ms fudge factor which makes times up to 1ms early or late and causes non-determinstic behaviour in the tests.

The sleep function call in JRuby may be buggy, or it simply may be less accurate by design. Sleep may return early for a variety of reasons, signals being one of the main ones. On some systems the granularity of the clock changes even based on power requirements. For more details see e.g. http://stackoverflow.com/questions/4128766/how-accurate-is-sleep-or-sleep and http://stackoverflow.com/questions/1719071/how-is-sleep-implemented-at-os-level and many other threads on the topic.

Yes, as you've suggested, I have worked around it at the site where sleep is called by putting it in a loop until there are no longer any timeouts. This is why the API was changed, so the while loop is simple as possible.

The only reason to make this change is to improve the accuracy of the timer timeout and also to fix the broken unit tests for JRuby on travis. It should also make the overall design much more tolerant to OS implementation details relating to `sleep` system call.