final class Local[T] extends AnyRef
A Local is a ThreadLocal
whose scope is flexible. The state of all Locals may
be saved or restored onto the current thread by the user. This is useful for
threading Locals through execution contexts.
Promises pass locals through control dependencies, not through data
dependencies. This means that Locals have exactly the same semantics as
ThreadLocals, if you think of continue
(the asynchronous sequence operator)
as semicolon (the synchronous sequence operator).
Because it's not meaningful to inherit control from two places, Locals don't have to worry about having to merge two Contexts.
Note: the implementation is optimized for situations in which save and restore optimizations are dominant.
- Alphabetic
- By Inheritance
- Local
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Local()
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(): Option[T]
Get the Local's optional value.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clear(): Unit
Clear the Local's value.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def let[U](value: T)(f: => U): U
Execute a block with a specific Local value, restoring the current state upon completion.
- def letClear[U](f: => U): U
Execute a block with the Local cleared, restoring the current state upon completion.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def set(optValue: Option[T]): Unit
Update the Local with a given optional value.
Update the Local with a given optional value.
General usage should be via let to avoid leaks.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def threadLocalGetter(): ThreadLocalGetter[T]
Creates a lightweight getter for the current thread.
Creates a lightweight getter for the current thread.
IMPORTANT: The returned getter *MUST* be used only by the thread that creates it.
This method is useful to avoid performance overhead if a local needs to be accessed several times by the same thread.
- def toString(): String
- Definition Classes
- AnyRef → Any
- def update(value: T): Unit
Update the Local with a given value.
Update the Local with a given value.
General usage should be via let to avoid leaks.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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()