Semaphore
A semaphore.
class Semaphore
Creating Semaphores
init(inTask: Mach.Task, policy: Mach.SemaphorePolicy, value: Int32
) throws Creates a new semaphore in the given task.
struct SemaphorePolicy
A synchronization policy for a semaphore.
Getting Basic Info
let policy: Mach.SemaphorePolicy
The synchronization policy of the semaphore.
let semaphoreOwningTask: Mach.Task
The task that owns the semaphore.
Operations
func signal(all: Bool
) throws Signals the semaphore.
func signal(Mach.Thread
) throws Signals a specific thread waiting on the semaphore.
func wait(timeout: mach_timespec_t?
) throws Waits for the semaphore.
static func wait(forSemaphore: Semaphore, thenSignalSemaphore: Semaphore, timeout: mach_timespec_t?
) throws Atomically waits for one semaphore and signals another.
func destroy(
) throws Destroys the semaphore.