Kernel.sleep(n) sleeps forever for n < 0.001
--------------------------------------------

                 Key: JRUBY-927
                 URL: http://jira.codehaus.org/browse/JRUBY-927
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 0.9.9
            Reporter: Andrew Geweke


Three facets of the same bug for Kernel.sleep(n):

  - 0 < n < 0.001: JRuby sleeps forever; MRI sleeps the time specified 
(presumably; it's awfully hard to measure intervals this short)
  - n = 0: JRuby sleeps forever; MRI returns immediately
  - n < 0: JRuby throws a Java exception (NativeException) from 
java.lang.Object.wait(); MRI raises an ArgumentError

The fix seems straightforward -- RubyKernel.java:544 (in JRuby 0.9.9); needs to 
add an "if (milliseconds > 0)" there, and whatever code is required above to 
throw a native-Ruby exception "if seconds.convertToFloat().getDoubleValue() == 
0.0".

Apologies for not including a patch -- I'm deep in the midst of my work using 
JRuby (building a scalability-testing tool using WATIR, but coupled to Apache 
Commons HTTPClient, not IE), and don't have a JRuby dev environment set up. But 
I hope to very soon...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to