Take a value from an
MVar, put a new value into the
MVar
and return the value taken. This function is atomic only if there are
no other producers for this
MVar. In other words, it cannot
guarantee that, by the time
swapMVar gets the chance to write
to the MVar, the value of the MVar has not been altered by a write
operation from another thread.