scala.concurrent.stm

SourceLike

trait SourceLike [+A, Context] extends AnyRef

Provides all of the operations of a Source[A], without the ability to get a Source.View.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. SourceLike
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def get (implicit txn: Context): A

    Performs a transactional read and checks that it is consistent with all reads already made by txn.

    Performs a transactional read and checks that it is consistent with all reads already made by txn. Equivalent to apply(), which is more concise in many situations.

    txn

    an active transaction.

    returns

    the value of the Ref as observed by txn.

    Attributes
    abstract
  2. def getWith [Z] (f: (A) ⇒ Z)(implicit txn: Context): Z

    Returns f(get), possibly reevaluating f to avoid rollback if a conflicting change is made but the old and new values are equal after application of f.

    Returns f(get), possibly reevaluating f to avoid rollback if a conflicting change is made but the old and new values are equal after application of f. Requires that f(x) == f(y) if x == y.

    getWith(f) is equivalent to f(relaxedGet({ f(_) == f(_) })), although perhaps more efficient.

    f

    an idempotent function.

    returns

    the result of applying f to the value contained in this Ref.

    Attributes
    abstract
  3. def relaxedGet (equiv: (A, A) ⇒ Boolean)(implicit txn: Context): A

    Returns the same value as get, but allows the caller to determine whether txn should be rolled back if another thread changes the value of this Ref before txn is committed.

    Returns the same value as get, but allows the caller to determine whether txn should be rolled back if another thread changes the value of this Ref before txn is committed. If ref.relaxedGet(equiv) returns v0 in txn, another context changes ref to v1, and equiv(v0, v1) == true, then txn won't be required to roll back (at least not due to this read). If additional changes are made to ref additional calls to the equivalence function will be made, always with v0 as the first parameter.

    equiv will always be invoked on the current thread. Extreme care should be taken if the equivalence function accesses any Refs.

    As an example, to perform a read that will not be validated during commit you can use the maximally permissive equivalence function:

       val unvalidatedValue = ref.relaxedGet({ (_, _) => true })
    

    To check view serializability rather than conflict serializability for a read:

       val viewSerializableValue = ref.relaxedGet({ _ == _ })
    

    The getWith method provides related functionality.

    equiv

    an equivalence function that returns true if a transaction that observed the first argument will still complete correctly, where the second argument is the actual value that should have been observed.

    returns

    a value of the Ref, not necessary consistent with the rest of the reads performed by txn.

    Attributes
    abstract

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def apply ()(implicit txn: Context): A

    Performs a transactional read and checks that it is consistent with all reads already made by txn.

    Performs a transactional read and checks that it is consistent with all reads already made by txn. Equivalent to get.

    Example:

       val x = Ref(0)
       atomic { implicit t =>
         ...
         val v = x() // perform a read inside a transaction
         ...
       }
    
    txn

    an active transaction.

    returns

    the value of the Ref as observed by txn.

  7. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  8. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  10. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef
  13. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  14. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  15. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  16. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  17. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  18. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  19. def toString (): String

    Definition Classes
    AnyRef → Any
  20. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  21. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  22. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any