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

Joel Reymont joelr1 at gmail.com
Tue Dec 6 09:09:03 EST 2005


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??

This makes total sense for the logger thread. I will implement this.

> 2) i hope that you already replaced passing a Chan to subroutines with
> passing an actions that read/write this Chan. in this case you can go
> further and add to this actions incrementing/decrementing MVar
> counter. but even without tests it's evident that 1000 producer  
> threads
> will get 1000 times more attention than 1 consumer thread if you don't
> have any restrictions on producing and consuming data.

The problem is that I have hundreds of other network client threads
that do not directly read from a socket. They communicate through  
TChans instead.
I believe they block someplace and I'm trying to troubleshoot this.  
Of course
moving the logger to use TMVars instead of TChan might immediately solve
my problems.

	Thanks, Joel

--
http://wagerlabs.com/







More information about the Haskell-Cafe mailing list