Section: Linux Programmer's Manual (3)
Return to Main Contents
sem_destroy - destroy an unnamed semaphore
int sem_destroy(sem_t *sem);
destroys the unnamed semaphore at the address pointed to by
Only a semaphore that has been initialised by
should be destroyed using
Destroying a semaphore that other processes or threads are
currently blocked on (in
produces undefined behaviour.
Using a semaphore that has been destroyed produces undefined results,
until the semaphore has been reinitialised using
returns 0 on success;
on error, -1 is returned, and
is set to indicate the error.
is not a valid semaphore.
An unnamed semaphore should be destroyed with
before the memory in which it is located is deallocated.
Failure to do this can result in resource leaks on some implementations.
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
linux.jgfs.net manual pages