sem_unlink(2)

sem_unlink2

Remove a named semaphore

Usage

#include <semaphore.h>

int

sem_unlink(const char *name);

Overview

The named semaphore named name is removed. If the semaphore is in use by other processes, then name is immediately disassociated with the semaphore, but the semaphore itself will not be removed until all references to it have been closed. Subsequent calls to sem_open() using name will refer to or create a new semaphore named name.

If successful, sem_unlink() will return 0. Otherwise, -1 is returned and errno is set, and the state of the semaphore is unchanged.

Errors

sem_unlink() succeeds unless:

[EACCES]

Permission is denied to be remove the semaphore.

[ENAMETOOLONG]

name exceeded PSEMNAMLEN characters.

[ENOENT]

The named semaphore does not exist.

Releases

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

  1. 10.0–10.1.5
  2. 10.2–10.3.9
  3. 10.4–10.4.11
  4. 10.5–10.10.5
  5. 10.11–26.5

History

sem_unlink() 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.