Packages

final class AtomicBoolean extends Atomic[Boolean]

Atomic references wrapping Boolean values.

Note that the equality test in compareAndSet is value based, since Boolean is a primitive.

Source
AtomicBoolean.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AtomicBoolean
  2. Atomic
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final macro def :=(value: Boolean): Unit

    Alias for set.

    Alias for set. Updates the current value.

    value

    will be the new value returned by get()

    Definition Classes
    Atomic
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final macro def apply(): Boolean

    Get the current value persisted by this Atomic, an alias for get().

    Get the current value persisted by this Atomic, an alias for get().

    Definition Classes
    Atomic
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. def compareAndSet(expect: Boolean, update: Boolean): Boolean

    Does a compare-and-set operation on the current value.

    Does a compare-and-set operation on the current value. For more info, checkout the related Compare-and-swap Wikipedia page.

    It's an atomic, worry free operation.

    expect

    is the value you expect to be persisted when the operation happens

    update

    will be the new value, should the check for expect succeeds

    returns

    either true in case the operation succeeded or false otherwise

    Definition Classes
    AtomicBooleanAtomic
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def flip(update: Boolean): Boolean

    Convenience method that expects the current value to be not the provided value.

    Convenience method that expects the current value to be not the provided value. Equivalent to compareAndSet(!update, update).

  12. def get(): Boolean

    Get the current value persisted by this Atomic.

    Get the current value persisted by this Atomic.

    Definition Classes
    AtomicBooleanAtomic
  13. def getAndSet(update: Boolean): Boolean

    Sets the persisted value to update and returns the old value that was in place.

    Sets the persisted value to update and returns the old value that was in place. It's an atomic, worry free operation.

    Definition Classes
    AtomicBooleanAtomic
  14. final macro def getAndTransform(cb: (Boolean) => Boolean): Boolean

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    returns

    the old value, just prior to when the successful update happened

    Definition Classes
    Atomic
  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def lazySet(update: Boolean): Unit

    Eventually sets to the given value.

    Eventually sets to the given value. Has weaker visibility guarantees than the normal set().

    Definition Classes
    AtomicBooleanAtomic
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. def set(update: Boolean): Unit

    Updates the current value.

    Updates the current value.

    update

    will be the new value returned by get()

    Definition Classes
    AtomicBooleanAtomic
  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    AtomicBoolean → AnyRef → Any
  25. final macro def transform(cb: (Boolean) => Boolean): Unit

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    Definition Classes
    Atomic
  26. macro def transformAndExtract[U](cb: (Boolean) => (U, Boolean)): U

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by your callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns a tuple that specifies the update + what should this method return when the operation succeeds.

    returns

    whatever was specified by your callback, once the operation succeeds

    Definition Classes
    Atomic
  27. macro def transformAndGet(cb: (Boolean) => Boolean): Boolean

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    returns

    whatever the update is, after the operation succeeds

    Definition Classes
    Atomic
  28. final macro def update(value: Boolean): Unit

    Alias for set.

    Alias for set. Updates the current value.

    value

    will be the new value returned by get()

    Definition Classes
    Atomic
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Atomic[Boolean]

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped