
ahhhh.... I had read mirco secords, but for some reason in my addled brain I
converted that to miliseconds. Doh!
Thans
On 5 July 2010 12:34, Ertugrul Soeylemez
Benjamin Edwards
wrote: I am looking to make a simple program that polls an interface once a second or so. I thought I could use threadDelay for this, so knocked up the following toy program to test my idea.
module TD where
import Control.Concurrent import Control.Concurrent.MVar
main :: IO () main = do mv <- newEmptyMVar forkIO $ loop mv 0 "Hai" takeMVar mv return () where loop mv n msg = do putStrLn msg threadDelay 10000 if n < 10 then loop mv (n+1) msg else putMVar mv ()
It doesn't work, in as much as I see all the messages printed seemingly as fast as Std out will print them. What am I doing wrong?
Note that threadDelay takes microseconds, not milliseconds. So 'threadDelay 1000000' should wait one second (at least).
Greets, Ertugrul
-- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners