[Haskell-cafe] Number of outstanding messages in Chan or TChan

Bulat Ziganshin bulatz at HotPOP.com
Tue Dec 6 12:50:33 EST 2005

Hello Joel,

Tuesday, December 06, 2005, 6:42:32 PM, you wrote:
JR> On Dec 6, 2005, at 1:47 PM, Bulat Ziganshin wrote:

>> either
>> 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 ()
waitForChildren = 
    do logDead <- newEmptyMVar
       forkIO (logger `finally` putMVar logDead ())
       c <- takeMVar children
       mapM_  takeMVar c
       ...send Nothing to logger thread
       takeMVar logDead

as simple as possible

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell-Cafe mailing list