compareAndSet

abstract fun compareAndSet(old: S, new: S): Boolean

Directly compare and set the current state.

Please read updateStateImmediate to learn about repercussions of using this.