Problem with System.Timeout in Windows

Hi All: I have been trying to use System.timeout in windows, but for some reason it doesn't work, a concrete example is: import Network.HTTP import System.Timeout main = do rsp <- timeout 10000000 $ simpleHTTP $ getRequest "http://10.1.2.3" case rsp of Just rsp -> print $ show rsp Nothing -> error "Nothing" In this case I would expect to receive "Nothing" after 10 seconds, but it ignores the timeout function. I'm compiling with -threaded, but it does not work either, I'm using ghc 6.12.2. Does someone know what could be going wrong ? Thanks !

I tried your example on 6.12.3 and it worked fine for me (Windows 7).
Ryan Yates
On Thu, Aug 5, 2010 at 1:35 AM, Adolfo Builes
Hi All:
I have been trying to use System.timeout in windows, but for some reason it doesn't work, a concrete example is:
import Network.HTTP import System.Timeout
main = do rsp <- timeout 10000000 $ simpleHTTP $ getRequest "http://10.1.2.3" case rsp of Just rsp -> print $ show rsp Nothing -> error "Nothing"
In this case I would expect to receive "Nothing" after 10 seconds, but it ignores the timeout function.
I'm compiling with -threaded, but it does not work either, I'm using ghc 6.12.2.
Does someone know what could be going wrong ?
Thanks ! _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Am 05.08.2010 07:35 schrieb Adolfo Builes:
Hi All:
I have been trying to use System.timeout in windows, but for some reason it doesn't work, a concrete example is:
import Network.HTTP import System.Timeout
main = do rsp <- timeout 10000000 $ simpleHTTP $ getRequest "http://10.1.2.3" case rsp of Just rsp -> print $ show rsp Nothing -> error "Nothing"
In this case I would expect to receive "Nothing" after 10 seconds, but it ignores the timeout function.
Hi Adolfo, the same behaviour for me with GHC 6.10.4 on Windows XP. If I set the timeout value to 0, I get *** Exception: Nothing immediately. Any other value results in *** Exception: connect: failed (Connection timed out (WSAETIMEDOUT)) after about 20 seconds. I don't know where the problem is, but I have similar problems with the threadDelay function. There must be something broken somewhere for some windows systems. Regards, Matthias
participants (3)
-
Adolfo Builes
-
Matthias Reisner
-
Ryan Yates