
18 Apr
2001
18 Apr
'01
12:52 p.m.
what is the Right Way to impose a timeout condition on IO actions? the GHC manual says ( http://www.haskell.org/ghc/docs/5.00/set/select.html ) "use threadDelay and asynchronous exceptions". When I do this: timed :: Int -> IO a -> IO a timed d action = do let timer = do threadDelay d throw $ AssertionFailed "timer expired" t <- forkIO timer x <- action killThread t return x it seems to work, but how do I turn off the "Fail: thread killed" messages? -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/252 --