[Haskell-cafe] accurately scheduling events

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue Apr 11 04:28:37 EDT 2006

On Tue, Apr 11, 2006 at 10:04:12AM +0200, Tomasz Zielonka wrote:
> - IIRC, Simon Marlow implemented registerTimeout for GHC 6.6 - maybe
>   it is more accurate than threadDelay... hmmm... I have HEAD somewhere,
>   so I'll try how it works

I used Simon's registerDelay (that's how it's called) and in a test
the average difference from expected waiting time dropped from
0.010140108245s to 0.00080999391s, which is pretty good.

I had to build with -threaded, because registerDelay requires
that. I tried ordinary threadDelay with -threaded and, surprise!,
the differences dropped too.

So, try building your programs with -threaded RTS, and see if now
threadDelay works for you :-)

Best regards

More information about the Haskell-Cafe mailing list