Sink[+A]
consists of the contra-variant write-only operations of
Ref[A]
.
Sink[+A]
consists of the contra-variant write-only operations of
Ref[A]
.
- Authors
Nathan Bronson
- Companion
- object
Value members
Inherited methods
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)
.
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)
.
- Value Params
- v
a value to store in the
Ref
.
- Throws
- IllegalStateException
if
txn
is not active.
- Inherited from
- SinkLike
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 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.
- Inherited from
- SinkLike
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)
.
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
...
}
- Value Params
- v
a value to store in the
Ref
.
- Throws
- IllegalStateException
if
txn
is not active.
- Inherited from
- SinkLike