MetadataLock

open class MetadataLock : ObjectBase

A lock for ensuring thread-safe access to mutable service metadata.

  • Default initializer.

    Declaration

    Swift

    override public init()
  • Read and write mutex

    Declaration

    Swift

    open var mutex: ReadWriteMutex { get }
  • Lock metadata to perform action that doesn’t change metadata. Note: This is a non-reentrant lock. If a thread tries to acquire a lock while already holding a lock, the thread will hang.

    Declaration

    Swift

    open func readLock(action: @escaping () throws -> Void) throws

    Parameters

    action

    Action to perform while a shared read lock (shared) is held.

  • Lock metadata to perform action that changes metadata.

    Declaration

    Swift

    open func writeLock(action: @escaping () throws -> Void) throws

    Parameters

    action

    Action to perform while an exclusive write lock is held.