Accurate Sleep for Java on Windows
        Posted  
        
            by HaBaLeS
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by HaBaLeS
        
        
        
        Published on 2009-05-05T09:40:25Z
        Indexed on 
            2010/06/07
            3:32 UTC
        
        
        Read the original article
        Hit count: 238
        
Does anyone know a Library which provides a Thread.sleep() for Java which has an error not higher than 1-2 Millisecond?
I tried a mixture of Sleep, error measurement and BusyWait but I don't get this reliable on different windows machines.
It can be a native implementation if the implementation is available for Linux and MacOS too.
EDIT The link Nick provided ( http://blogs.sun.com/dholmes/entry/inside_the_hotspot_vm_clocks ) is a really good resource to understand the issues all kinds of timers/sleeps/clocks java has.
© Stack Overflow or respective owner