Atomically reads the current value and replaces it with value.
Example:
val tvar = TVar.new("old")val previous = tvar.getAndSet("new") // "old"
the old value before the swap
the new value to set