
29 Nov
2005
29 Nov
'05
5:11 a.m.
Simon, How is this easier than just calling threadDelay? Ideally, I would be looking for something like reading from a TVar with a timeout. So that you either get a Nothing (timeout) or the value from the TVar. Can I implement it using the GHC timeout thread? Thanks, Joel On Nov 29, 2005, at 9:20 AM, Simon Marlow wrote:
Interestingly, GHC already has a timeout thread - the I/O manager thread handles threadDelay too. It wouldn't be too hard to adapt it to do STM timeouts too, with a function like
registerTimeout :: Int -> STM (TVar Bool)
and you wait for your timeout by waiting for the TVar to contain True.