Performs a transactional write.
Performs a transactional write. The new value will not be visible by
any other threads until (and unless) txn
successfully commits.
Equivalent to update(v)
.
a value to store in the Ref
.
if txn
is not active.
See Ref.single
.
Performs a transactional write and returns true, or returns false.
Performs a transactional write and returns true, or returns false. The STM implementation may choose to return false to reduce (not necessarily avoid) blocking. If no other threads are performing any transactional or atomic accesses then this method will succeed.
Performs a transactional write.
Performs a transactional write. The new value will not be visible by
any other threads until (and unless) txn
successfully commits.
Equivalent to set(v)
.
Example:
val x = Ref(0) atomic { implicit t => ... x() = 10 // perform a write inside a transaction ... }
a value to store in the Ref
.
if txn
is not active.
Sink[+A]
consists of the contra-variant write-only operations ofRef[A]
.