[Haskell-cafe] Question about takeMVar

Maurí­cio briqueabraque at yahoo.com
Wed Nov 28 20:52:54 EST 2007


'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

Does that mean that all threads waiting for
that MVar will get the same value, even if
one of those threads change it's value just
after reading?


More information about the Haskell-Cafe mailing list