Mutex

A Mutex is a mutual exclusion lock.

  • Returns a new Mutex.

    Declaration

    Swift

    public init()
  • Locks the mutex. If the lock is already in use, the calling operation blocks until the mutex is available.

    Declaration

    Swift

    public func lock()
  • Unlocks the mutex. It’s an undefined error if mutex is not locked on entry to unlock.

    A locked Mutex is not associated with a particular operation. It is allowed for one operation to lock a Mutex and then arrange for another operation to unlock it.

    Declaration

    Swift

    public func unlock()
  • Locks the mutex before calling the function. Unlocks after closure is completed - Parameter: closure Closure function

    Declaration

    Swift

    public func lock(closure : ()->())