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).
|Signal handler||Yes, but modifies errno|
errno, sem_init(), sem_post(), sem_trywait(), sem_wait()