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

2009-09-16 Thread Simon Marlow
On 13/09/2009 07:45, Belka wrote: 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

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

2009-09-16 Thread Bulat Ziganshin
Hello Simon, Wednesday, September 16, 2009, 7:05:04 PM, you wrote: 1. Might readMVar really be computationally expensive under heavy load, (with all it's wonderful blocking features)? How much (approximately) more expensive, comparing to a assembler's mov? Probably 10-100 times more

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

2009-09-13 Thread Felix Martini
Bulat Ziganshin 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 Is it also safe for other types such as Int? And is this documented somewhere? If not it would be helpful to

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

2009-09-13 Thread Bulat Ziganshin
Hello Felix, Monday, September 14, 2009, 2:39:17 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 Is it also safe for other types such as Int? And is this