Neil Mitchell wrote:
Hi

I'm using the System.Timeout module from base, copied into my local
repo, so that I can work with GHC 6.6.1. My copy is at:
http://www.cs.york.ac.uk/fp/darcs/catch/catch_1/System/TimeoutGHC.hs
(but it is identical to the one in base)

Sadly, it doesn't seem to work for me. Here are the tests I've been
using, the results I get, and what I would have liked. All are GHC 6.6
on Windows.

-- TEST 1
import System.TimeoutGHC

main :: IO ()
main = do
   r <- timeout (5 * 10^6) (putStrLn "here")
   print r

Without -threaded:
here >> Just () >> wait 5 seconds

Without -threaded:
here >> wait 5 seconds >> Just ()

So, either way, I get a 5 second delay - not something I want.

I think you're using GHC 6.6, right? 6.6.1 with -threaded has a new implementation of threadDelay on Windows that eliminates the final 5 second wait. The problem was that threadDelay used to spawn a new OS thread to do the sleep, and the RTS would refuse to shut down until all the threads had finished (the latter requirement was introduced to fix bug with DLL shutdown, grrr). We still have a similar bug that affects I/O: http://hackage.haskell.org/trac/ghc/ticket/1177

Cheers,
        Simon
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to