object Ref extends RefCompanion
object Ref
contains factory methods that allocate an STM-managed memory
location and return a Ref
instance that provides access to that location.
- Alphabetic
- By Inheritance
- Ref
- RefCompanion
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait View[A] extends Source.View[A] with Sink.View[A]
Ref.View
provides access to the contents of aRef
without requiring that an implicitInTxn
be available.Ref.View
provides access to the contents of aRef
without requiring that an implicitInTxn
be available. When called from within the dynamic scope of a transaction,View
's methods operate as part of that transaction. When there is no transaction activeView
's methods are still atomic, but only for the duration of the method call.A mental model of
View
is thatview.foo(args)
acts likeatomic { implicit t => view.ref.foo(args) }
.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply(initialValue: Unit): Ref[Unit]
- Definition Classes
- RefCompanion
- def apply(initialValue: Double): Ref[Double]
- Definition Classes
- RefCompanion
- def apply(initialValue: Float): Ref[Float]
- Definition Classes
- RefCompanion
- def apply(initialValue: Long): Ref[Long]
- Definition Classes
- RefCompanion
- def apply(initialValue: Int): Ref[Int]
- Definition Classes
- RefCompanion
- def apply(initialValue: Char): Ref[Char]
- Definition Classes
- RefCompanion
- def apply(initialValue: Short): Ref[Short]
- Definition Classes
- RefCompanion
- def apply(initialValue: Byte): Ref[Byte]
- Definition Classes
- RefCompanion
- def apply(initialValue: Boolean): Ref[Boolean]
- Definition Classes
- RefCompanion
- def apply[A](initialValue: A)(implicit om: OptManifest[A]): Ref[A]
Returns a
Ref
instance that manages a newly allocated memory location, initializing it to holdinitialValue
.Returns a
Ref
instance that manages a newly allocated memory location, initializing it to holdinitialValue
. The returnedRef
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]]
- Definition Classes
- RefCompanion
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def factory: RefFactory
- Attributes
- protected
- Definition Classes
- Ref → RefCompanion
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def make[A]()(implicit om: OptManifest[A]): Ref[A]
Returns a
Ref
instance that manages a newly allocated memory location holding values of typeA
.Returns a
Ref
instance that manages a newly allocated memory location holding values of typeA
. If you have an initial valuev0
available,Ref(v0)
should be preferred.- Definition Classes
- RefCompanion
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated