The GNU C Library implements the semaphore APIs as defined in POSIX and System V. Semaphores can be used by multiple processes to coordinate shared resources. The following is a complete list of the semaphore functions provided by the GNU C Library.
int
semctl (int semid, int semnum, int cmd)
¶Preliminary: | MT-Safe | AS-Safe | AC-Unsafe corrupt/linux | See POSIX Safety Concepts.
int
semget (key_t key, int nsems, int semflg)
¶Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.
int
semop (int semid, struct sembuf *sops, size_t nsops)
¶Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.
int
semtimedop (int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout)
¶Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.
The GNU C Library provides POSIX semaphores as well. These functions’ names begin
with sem_
and they are declared in semaphore.h. See POSIX Semaphores.