Hello, Haskell Cafe!
I used an MVar to signalize to many threads, when it's time to finish their
business (I called it a LoopBreaker). Recently I realized, that it might be
too expensive (to use MVar) for cases when threads are many and all of them
read my LoopBreaker intensively. This
Hello Belka,
Sunday, September 13, 2009, 10:45:35 AM, you wrote:
i suggest you to use IORef Bool instead - as it was said once by
SimonM, it's safe to use in m/t environment, of course without all
fancy features of MVar locking
if you need to be as fast as possible, IOUArray (1,1) may be used -
Hello Belka,
Sunday, September 13, 2009, 10:45:35 AM, you wrote:
I used an MVar to signalize to many threads, when it's time to finish their
business (I called it a LoopBreaker).
btw, may be you can change the architecture? in particular, where
these threads getting their jobs? if they read
Thank you, Bulat, for both your suggestions!
1. Since Haskell uses 1 byte for Bool (I confidently guess) and it's safe,
it would also be safe to use IORef Word8. Moreover, I found
http://hackage.haskell.org/packages/archive/ArrayRef/0.1.3.1/doc/html/Data-Ref-Unboxed.html#v%3AmodifyIOURef
your
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