Semaphore

public class Semaphore

Represents a semaphore object.
Note that named semaphores are shared accross different processes.

  • The maximum length for a semaphore name.

    Declaration

    Swift

    public static var nameMaximumLength: Int
  • Whether the semaphore is named.
    Note that named semaphores are shared accross different processes.

    Declaration

    Swift

    public private( set ) var isNamed: Bool
  • The name of the semaphore, if any.
    Note that named semaphores are shared accross different processes.

    Declaration

    Swift

    public private( set ) var name: String?
  • Declaration

    Swift

    public enum Error: Swift.Error
  • Initializes a semaphore object.

    Throws

    Semaphore.Error on failure.

    Declaration

    Swift

    public init( count: Int32 = 1, name: String? = nil ) throws
  • Locks the semaphore.

    Declaration

    Swift

    public func wait()
  • Signals (unlocks) the semaphore.

    Declaration

    Swift

    public func signal()
  • Tries to lock the semaphore.

    Declaration

    Swift

    public func tryWait() -> Bool

    Return Value

    true if the semaphore was successfully locked, otherwise false.