[Haskell-cafe] scheduling an alarm

Brian Denheyer briand at aracnet.com
Wed Jan 27 01:17:12 EST 2010


On Tue, 26 Jan 2010 10:54:03 -0800
Thomas DuBuisson <thomas.dubuisson at gmail.com> wrote:

> > doEvent f usDelay = forkIO $
> >   threadDelay usDelay
> >   doEvent f usDelay
> >   f

Are you sure that's right ? It seems to be a memory-gobbling infinite
loop...

How about this:


f = putStrLn "foo"

doEvent f usDelay = do forkIO f
                       threadDelay usDelay
                       doEvent f 1000000

main = doEvent f 1000000

which seems to work.  That makes me suspicious :-|


Brian



More information about the Haskell-Cafe mailing list