Destroy a semaphore
#include <semaphore.h> int sem_destroy( sem_t * sem );
libc
The sem_destroy() function destroys the unnamed semaphore referred to by the sem argument. The semaphore must have been previously initialized by the sem_init() function.
The effect of using a semaphore after it has been destroyed is undefined. Also, if you destroy a semaphore on which other process's are currently blocked, they are unblocked, with an error (EINVAL).
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
sem_init(), sem_post(), sem_trywait(), sem_wait()