Ref.View
provides access to the contents of a Ref
without requiring
that an implicit InTxn
be available.
Returns a Ref
instance that manages a newly allocated memory location,
initializing it to hold initialValue
.
Returns a Ref
instance that manages a newly allocated memory location,
initializing it to hold initialValue
. The returned Ref
is not part
of any transaction's read or write set.
Example:
val x = Ref("initial") // creates a Ref[String] val list1 = Ref(Nil : List[String]) // creates a Ref[List[String]] val list2 = Ref[List[String]](Nil) // creates a Ref[List[String]]
Returns a Ref
instance that manages a newly allocated memory location
holding values of type A
.
Returns a Ref
instance that manages a newly allocated memory location
holding values of type A
. If you have an initial value v0
available,
Ref(v0)
should be preferred.
object Ref
contains factory methods that allocate an STM-managed memory location and return aRef
instance that provides access to that location.