ThreadLocal

open class ThreadLocal<T>

port of java.lang.ThreadLocal

Constructors

Link copied to clipboard
constructor()

Creates a thread local variable.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun get(): T?

Returns the value in the current thread's copy of this thread-local variable. If the variable has no value for the current thread, it is first initialized to the value returned by an invocation of the initialValue method.

Link copied to clipboard
open fun remove()

Removes the current thread's value for this thread-local variable.

Link copied to clipboard
open fun set(value: T?)

Sets the current thread's copy of this thread-local variable to the specified value. Most subclasses will have no need to override this method, relying solely on the initialValue method to set the values of thread-locals.