sem_destroy(2)sem_destroy(2)NAMEsem_destroy - destroy an unnamed POSIX semaphore
SYNOPSISDESCRIPTION
is used to destroy an unnamed semaphore. A successful call to will
invalidate the unnamed semaphore referred to by sem and removes all
descriptors referencing it. The semaphore should have been created by
a previous call to and there should not be any processes blocked on it.
To use this function, link in the realtime library by specifying on the
compiler or linker command line.
EXAMPLES
The following call to will destroy an unnamed semaphore referred to by
sem and remove all descriptors referencing it.
RETURN VALUE
If the semaphore was destroyed and the descriptors referencing it were
removed, returns 0 to the caller.
If the semaphore could not be destroyed, the call returns -1 and sets
to indicate the error.
ERRORS
fails and does not perform the requested operation if any of the fol‐
lowing conditions are encountered:
[EBUSY] There are threads currently blocked on the sema‐
phore or there are outstanding locks held on the
semaphore.
[EINVAL] The argument sem is not a valid unnamed sema‐
phore.
SEE ALSOsem_init(2), sem_open(2), <semaphore.h>.
STANDARDS CONFORMANCEsem_destroy(2)