[Haskell-cafe] Using tiny (atomic) mutables between multiple threads

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Sep 14 01:37:04 EDT 2009


Hello Belka,

Monday, September 14, 2009, 8:05:26 AM, you wrote:

> http://www.haskell.org/haskellwiki/Library/ArrayRef the
> corresponding article in HaskellWiki , so I plan to use <IOURef Word8>. I

if it's compatible with your ghc version :D i don't support this
library but other people may keep it up-to-dtae

> wonder, however, what's the difference between <Foreign.Ptr Word8> and
> <IORef Word8> (or <IOURef Word8>)?

read http://haskell.org/haskellwiki/Modern_array_libraries ,
especially "welcome to machine" part. it doesn't describe everything
but at least a good starting point

> 2. As for architecture, I'm not sure that understood the whole suggestion,
> but got inspired for new ideas for sure! :) 
> My thread's iterations mostly are to acquire resource from load-balancers'
> chans, and then to react on outer world state changes - networking and DB. I
> put all the blocking operations to be stoppable by LoopBreaker. There's no
> real need in job production/execution separation (in most cases) for now

it's just a way to stop executor threads when you are done. cheap
threads make it possible to use threading as one more control
structure. you can capture this pattern in function and stop worrying
about program speed/complexity


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list