`threadDelay (maxBound :: Int)` 会触发 GHC 错误还是什么?
Does `threadDelay (maxBound :: Int)` trip a GHC bug or what?
我希望我的程序基本上永远锁定,我的第一个想法是:
threadDelay (maxBound :: Int)
这给出了一些虚假警告:
Prelude> import Control.Concurrent
Prelude Control.Concurrent> threadDelay 10
Prelude Control.Concurrent> threadDelay (maxBound :: Int)
<interactive>: c_poll: invalid argument (Invalid argument)
<interactive>: ioManagerWakeup: write: Bad file descriptor
是我做错了还是GHC做错了?
这似乎是 known GHC bug,取得了一些进展(尽管似乎还没有修复所有配置)。
同时,您可以使用 forever (threadDelay (2^20))
或类似的解决方法; 2^20
应该距离 maxBound
足够远以避免这个错误,并且在你的系统上每秒唤醒一次并持续几个周期应该很容易。
我希望我的程序基本上永远锁定,我的第一个想法是:
threadDelay (maxBound :: Int)
这给出了一些虚假警告:
Prelude> import Control.Concurrent
Prelude Control.Concurrent> threadDelay 10
Prelude Control.Concurrent> threadDelay (maxBound :: Int)
<interactive>: c_poll: invalid argument (Invalid argument)
<interactive>: ioManagerWakeup: write: Bad file descriptor
是我做错了还是GHC做错了?
这似乎是 known GHC bug,取得了一些进展(尽管似乎还没有修复所有配置)。
同时,您可以使用 forever (threadDelay (2^20))
或类似的解决方法; 2^20
应该距离 maxBound
足够远以避免这个错误,并且在你的系统上每秒唤醒一次并持续几个周期应该很容易。