From: Harry Date: 2007-04-27T17:41:05+09:00 Subject: Re: 10 millisecond delay/callback ------=_Part_47565_17256846.1177663263848 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 4/27/07, Earle Clubb wrote: > > I need to perform a task every 10ms. I've been using > kernel.sleep(0.01), but sleep seems to be slow and erratic at sub-second > resolutions. Here's a test I ran along with the results: > > irb(main):001:0> 0.upto(25) do > irb(main):002:1* puts Time.now.usec/1000 > irb(main):003:1> STDOUT.flush > irb(main):004:1> sleep 0.01 > irb(main):005:1> end > > > So I'm wondering if there's a way to get a steady 10ms delay. Another > option would be to set up an alarm or scheduled callback or something > every 10ms. Is this possible. > > > I ran your code as a script and it worked fine on Windows XP. I did not try irb. Harry -- http://www.kakueki.com/ruby/list.html A Look into Japanese Ruby List in English ------=_Part_47565_17256846.1177663263848--