On Dec 15, 2005, at 12:08 AM, Einar Karttunen wrote:

timeout = 5000000 -- 1 second

Is that correct?

I think so. threadDelay takes microseconds.

Here is a nice trick for you:

Thanks!

--- The filter expression is kind of long...
stopTimer :: String -> IO ()
stopTimer name =
    block $ do t <- takeMVar timers
               putMVar timers $
                       M.filterWithKey (\(_, k) _ -> k /= name) t

And slow. This is O(size_of_map)

Any way to optimize it? I need timer ids so that I can remove a timer before it expires. And I need ClockTime as key to so that I don't have to wake up every second, etc.

        Joel

--
http://wagerlabs.com/





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

Reply via email to