View

trait View[-A]

Sink.View[+A] consists of the contra-variant write-only operations of Ref.View[A].

Sink.View[+A] consists of the contra-variant write-only operations of Ref.View[A].

class Object
trait Matchable
class Any
trait View[A]

Value members

Abstract methods

def ref: Sink[A]

Returns a Sink that accesses the same memory location as this view. The returned Sink might be the original reference that was used to construct this view, or it might be a Sink that is equivalent (and ==) to the original.

Returns a Sink that accesses the same memory location as this view. The returned Sink might be the original reference that was used to construct this view, or it might be a Sink that is equivalent (and ==) to the original.

Returns

a Sink that accesses the same memory location as this view.

def set(v: A): Unit

Performs an atomic write; equivalent to update(v).

Performs an atomic write; equivalent to update(v).

def trySet(v: A): Boolean

Performs an atomic 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 an atomic 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.

Concrete methods

def update(v: A): Unit

Performs an atomic write of the value in ref. If an atomic block is active (see Txn.findCurrent) then the write will be performed as part of the transaction, otherwise it will act as if it was performed inside a new atomic block. Equivalent to set(v).

Performs an atomic write of the value in ref. If an atomic block is active (see Txn.findCurrent) then the write will be performed as part of the transaction, otherwise it will act as if it was performed inside a new atomic block. Equivalent to set(v).