Lock

public class Lock<T>

A thread-safe lock around a value of type T.

  • Undocumented

    Declaration

    Swift

    public class Lock<T>
  • Declaration

    Swift

    public func get() -> Future<T>

    Return Value

    A future of the value of this lock.

  • Set the value of this lock.

    Declaration

    Swift

    public func set(newValue: T)
  • Set the value of this lock to a value derived from the current value.

    Declaration

    Swift

    public func mutate(handler: T -> T)
  • Get read/write access to the value in this lock.

    Declaration

    Swift

    public func acquire<U>(handler: inout T -> U) -> Future<U>

    Parameters

    handler

    A function to give access.

    Return Value

    A future representing the value returned by handler.