ThreadSpecificVariable

    A ThreadSpecificVariable is a variable that can be read and set like a normal variable except that it holds different variables per thread.

    Thread.swift:154
    final class ThreadSpecificVariable<Value> where Value : AnyObject

    ThreadSpecificVariable is thread-safe so it can be used with multiple threads at the same time but the value returned by currentValue is defined per thread.

    Citizens in NIOPosix

    Type members

    • init()

      Initialize a new ThreadSpecificVariable without a current value (currentValue == nil).

    • init(value: Value)

      Initialize a new ThreadSpecificVariable with value for the calling thread. After calling this, the calling thread will see currentValue == value but on all other threads currentValue will be nil until changed.

    Instance members

    Citizens in NIOPosix

    where Value:Sendable

    Conformances

    • protocol Sendable

      A type whose values can safely be passed across concurrency domains by copying.