Brian Denheyer <bri...@aracnet.com> writes:

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

There's a missing 'do' here, right?

>> Infinite loop?  yes, that is what you wanted.  Memory gobbling?  Why
>> would you think that?

> Why would I think that ?

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

Are you sure this isn't interpreted as:

    doEvent f usDelay = do (forkIO $ threadDelay usDelay)
                           doEvent f usDelay
                           f

I.e. just forking off processes that only does a delay, never even
getting to 'f'?

I interpreted Thomas's code to mean:

    doEvent f usDelay = forkIO $ 
                 (do threadDelay usDelay
                     doEvent f usDelay
                     f)

Which appears to work nicely here.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to