[Haskell-cafe] Number of outstanding messages in Chan or TChan
bulatz at HotPOP.com
Tue Dec 6 12:50:33 EST 2005
Tuesday, December 06, 2005, 6:42:32 PM, you wrote:
JR> On Dec 6, 2005, at 1:47 PM, Bulat Ziganshin wrote:
>> 1) use MVars/TMVars instead of Channels. in any case your logging
>> thread must consume data not slower than other channels produce then.
>> in fact, using Chan have meaning only to smooth temporary speed
>> differences between different threads. are you really need this??
btw, why not pass to worker thread just the logging action itself?
and, about waitForChildren:
waitForChildren :: IO ()
do logDead <- newEmptyMVar
forkIO (logger `finally` putMVar logDead ())
c <- takeMVar children
mapM_ takeMVar c
...send Nothing to logger thread
as simple as possible
Bulat mailto:bulatz at HotPOP.com
More information about the Haskell-Cafe