> 'takeMVar' documentation says "if there are > multiple threads blocked in takeMVar, and the > MVar becomes full, only one thread will be > woken up." > > Since 'takeMVar' is a reading function, i.e., > it doesn't change the value of the > "variable", why waking up only one thread? If > we wake multiple threads, there's no risk of > one changing the value while the other is > reading.
Also in the docs: After a takeMVar, the MVar is left empty. The behaviour you describe is more like readMVar. Because readMVar does a takeMVar followed by a putMVar, it will wake up multiple threads. If you want to broadcast to multiple threads, you might also want to consider dupChan in Control.Concurrent.Chan. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe