The sem_destroy function is used to destroy the unnamed
semaphore indicated by sem. Only a semaphore which was
created using
sem_init(S)
may be destroyed using sem_destroy.
Return values
Upon successful completion, a value of zero is returned. Otherwise,
a value of -l is returned and errno is set to indicate
the error.
Diagnostics
If the following condition occurs, the sem_destroy
function returns -1 and sets errno to the corresponding
value:
[EINVAL]
The sem argument is not a valid semaphore.
If the following condition is detected, the sem_destroy
function returns -1 and sets errno to the corresponding
value:
[EBUSY]
There are currently processes blocked on the semaphore.