[Haskell-cafe] Threads talking back to parent

Joel Reymont joelr1 at gmail.com
Thu Nov 3 14:26:40 EST 2005


So when should I use a STM TChan instead of a regular Chan?

On Oct 31, 2005, at 10:08 PM, ChrisK wrote:

> Or perhaps a TChan, if that is more appropriate:
>
> http://www.haskell.org/ghc/docs/latest/html/libraries/stm/Control- 
> Concurrent-STM-TChan.html
>
> I like the curried command idiom:

I'm not sure I understand this. Are you trying to show that the same  
logToParent approach can be used with Chan, TChan and MVar below?

> do chan <- newChan
>    let logToParent =  writeChan chan
>
> do tChan <- newTChan
>    let logToParentSTM = writeTChan tChan
>    let logToParent = atomically.logToParentSTM
>
> do mVar <- newEmptyMVar
>    let logToParent = putMVar mVar

	Thanks, Joel

--
http://wagerlabs.com/







More information about the Haskell-Cafe mailing list