Destroys an unnamed semaphore. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <semaphore.h> int sem_destroy (sem_t *sem);
1 – Argument
sem The unnamed semaphore to be destroyed. Use the sem argument that was supplied to, and filled in by, the previous call to sem_init.
2 – Description
The sem_destroy function destroys an unnamed semaphore indicated by sem. Only a semaphore created using sem_init may be destroyed using sem_destroy. The potential for deadlock exists if a process calls sem_destroy for a semaphore while there is a pending sem_wait, because a process may be waiting for a poster that has not yet opened the semaphore.
3 – Return Values
0 Successful completion. -1 Indicates an error. The function sets errno to one of the following values, without destroying the semaphore indicated by the sem argument: o EINVAL - The sem argument is not a valid semaphore. o ENOSYS - The function is not implemented. o EVMSERR - OpenVMS specific nontranslatable error code. o EBUSY - The processes are blocked on the semaphore.