I want my program to basically lockup forever and the first idea I had was:
threadDelay (maxBound :: Int)
This gave some spurious warnings:
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
Did I do wrong or did GHC?
This seems to be a known GHC bug, with some progress made (though not all configurations appear to be fixed yet).
In the meantime, you could use forever (threadDelay (2^20))
or similar as a workaround; 2^20
ought to be far enough away from maxBound
to avoid this bug, and waking up once a second for a few cycles should be quite easy on your system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With