Class

DispatchSemaphore

DispatchSemaphore provides an efficient implementation of a traditional counting semaphore, which can be used to control access to a resource across multiple execution contexts.

Overview

You increment a semaphore count by calling the signal() method, and decrement a semaphore count by calling the wait() method or one of its variants that specifies a timeout.

Topics

Initializers

init(value: Int)

Creates new counting semaphore with an initial value.

Instance Methods

func wait()

Waits for, or decrements, a semaphore.

func wait(timeout: DispatchTime)

Waits for, or decrements, a semaphore.

func wait(wallTimeout: DispatchWallTime)

Waits for, or decrements, a semaphore.

Relationships

Inherits From