Multithreaded Programming Guide

sem_destroy(3R)

Prototype:
int	sem_destroy(sem_t *sem);
#include <semaphore.h>

sem_t sem;
int ret;

ret = sem_destroy(&sem); /* the semaphore is destroyed */

Use sem_destroy() to destroy any state associated with the semaphore pointed to by sem. The space for storing the semaphore is not freed.

Return Values

sem_destroy() returns zero after completing successfully. Any other returned value indicates that an error occurred. When the following condition occurs, the function fails and returns the corresponding value.


EINVAL

sem points to an illegal address.