/// Atomically, take a value from the `MVar`, put a given new value in the
/// `MVar`, then return the `MVar`'s old value.
public func swap(_ x : A) -> A {
let old = self.take()
self.put(x)
return old
}
The thread using swap might context-switch right after the take completes before the put -- if another thread puts then, this put will block.