update

abstract suspend fun update(f: (A) -> A)(source)

Updates the current value using the supplied function f.

If another modification occurs between the time the current value is read and subsequently updated, the modification is retried using the new value. Hence, f may be invoked multiple times.