NAME
semdestroy - destroy an unnamed semaphore SYNOPSIS
#include
int semdestroy(semt *sem); Link with -pthread. DESCRIPTION semdestroy() destroys the unnamed semaphore at the address pointed to by sem. Only a semaphore that has been initialized by seminit(3) should be destroyed using semdestroy(). Destroying a semaphore that other processes or threads are currently blocked on (in semwait(3)) produces undefined behavior. Using a semaphore that has been destroyed produces undefined results, until the semaphore has been reinitialized using seminit(3). RETURN VALUE
semdestroy() returns 0 on success; on error, -1 is returned, and errno is set to indicate the error. ERRORS EINVAL sem is not a valid semaphore. ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌──────────────┬───────────────┬─────────┐ │Interface │ Attribute │ Value │ ├──────────────┼───────────────┼─────────┤
│semdestroy() │ Thread safety │ MT-Safe │ └──────────────┴───────────────┴─────────┘ CONFORMING TO
POSIX.1-2001. NOTES An unnamed semaphore should be destroyed with semdestroy() before the memory in which it is located is deallocated. Failure to do this can result in resource leaks on some implementations. SEE ALSO seminit(3), sempost(3), semwait(3), semoverview(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2012-05-13 SEMDESTROY(3)