- Source
- Ref.scala
Def
Change value
Change value
Changes value based on function, which takes the old value and produces new one.
Returns the new value
Note. The provided function can be invoked and generate new value multiple times, and only last generated value will be returned (the others discarded).
- Source
- Ref.scala
Try to replace the target value
Try to replace the target value
Provides the old and the new values
Returns true if value is successfully changed, false if old value is not longer current (was changed by other thread) and the change failed.
- Source
- Ref.scala