Race-condition in alternative 'System.Timeout.timeout' implementation

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Mon Feb 25 10:27:31 CET 2013


Dear Herbert,

> I've been experimenting with an alternative implementation of
> 'System.Timeout.timeout'[1] which avoids the overhead of spawning a new
> thread for each invocation.

Be warned that timeouts are very intricate. We had a lengthy discussion
on the topic 2 years ago, starting at

  http://www.haskell.org/pipermail/libraries/2011-February/015876.html

There was even an IO manager based proposal similar to yours:

  http://hackage.haskell.org/trac/ghc/ticket/4963
  (What's the busyWontTimeout benchmark mentioned there?)
  http://www.haskell.org/pipermail/libraries/2011-February/015953.html

The main trouble with the IO manager based approach is that even
after unregisterTimeout finished, the timeout may still be invoked,
and additional work is needed to protect against that.

(I have more to say on this, but will postpone it until later. A lot
of it has already been said in the earlier thread anyway.)

Best regards,

Bertram



More information about the Glasgow-haskell-users mailing list