destroy a semaphore
#include <semaphore.h> int sem_destroy( sem_t *sem );
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 processes are currently blocked, they're unblocked, with an error (EINVAL).
/usr/demo/src/semaphores
POSIX 1003.1b-1993
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
errno, sem_init(), sem_post(), sem_trywait(), sem_wait()