[Haskell-cafe] threadDelay delays less time than expected (Windows)

Sven Panne svenpanne at gmail.com
Thu Dec 29 18:54:59 UTC 2016


2016-12-29 17:27 GMT+01:00 Joey Hess <id at joeyh.name>:

> [...] It would perhaps be good for the documentation for threadDelay to
> point
> out that it can delay for a maximum of 71 minutes on 32 bit systems, and
> point to the unbounded-delays package.
>

... or even better: Absorb the functions from unbounded-delays into base.
In their current state, I would consider both threadDelay and timeout API
bugs, see
http://www.aristeia.com/Papers/IEEE_Software_JulAug_2004_revised.htm (*"**Make
interfaces easy to use correctly and hard to use incorrectly."). *Perhaps
we should add:

   genericThreadDelay :: Integral
<https://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#t:Integral>
i
=> i -> IO
<https://hackage.haskell.org/package/base-4.7.0.1/docs/System-IO.html#t:IO>
 ()
  genericTimeout :: Integral
<https://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#t:Integral>
i
=> i -> IO
<https://hackage.haskell.org/package/base-4.7.0.1/docs/System-IO.html#t:IO> a
-> IO
<https://hackage.haskell.org/package/base-4.7.0.1/docs/System-IO.html#t:IO>
 (Maybe
<https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Maybe.html#t:Maybe>
 a)

to their respective modules, following Data.List's example. The *real* fix
IMHO would be having the equivalent of C++'s <chrono> facilities in base,
so we could use a duration data type here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161229/67ef347a/attachment.html>


More information about the Haskell-Cafe mailing list