sem_post(2)

sem_post2

Unlock a semaphore

Usage

#include <semaphore.h>

int

sem_post(sem_t *sem);

Overview

The semaphore referenced by sem is unlocked, the value of the semaphore is incremented, and all threads which are waiting on the semaphore are awakened.

sem_post() is reentrant with respect to signals and may be called from within a signal hanlder.

If successful, sem_post() will return 0. Otherwise, -1 is returned and errno is set.

Errors

sem_post() succeeds unless:

[EINVAL]

sem is not a valid semaphore descriptor.

Releases

161 releases since Mac OS X 10.0; the text changed 2 times.

  1. 10.0–10.1.5
  2. 10.2–10.4.11
  3. 10.5–26.5

History

sem_post() is specified in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995).

From xnu 12377.121.6 in macOS 26.5. Parsed by carta from the page's mdoc source.