[Haskell-cafe] Question about takeMVar
Maurício
briqueabraque at yahoo.com
Wed Nov 28 20:52:54 EST 2007
Hi,
'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.
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?
Thanks,
Maurício
More information about the Haskell-Cafe
mailing list