sem_destroy(2) DG/UX 5.4 Rel. 2.01 sem_destroy(2)
NAME
sem_destroy - close access to a semaphore
SYNOPSIS
#include <semaphore.h>
int semdestroy (*sem)
semt *sem;
DESCRIPTION
Use semdestroy(2) to indicate that your process is finished using a
semaphore: sem is a valid semaphore descriptor returned by a prior
seminit(2) call. After making this call, your process cannot again
access sem without first calling seminit(2).
Whenever a process calls exit(2) or exec(2), an implicit semdestroy
is made on all its semaphores.
This call closes (destroys a descriptor to) but does not remove or
affect the state of a semaphore. However, if a process calls
semunlink(2) to remove a semaphore, the removal takes place as soon
as the last of the processes attached to the semaphore calls
semdestroy(2), exit(2), or exec(2).
Note
* This routine is based on POSIX realtime extension document P1003.4
draft 12. It is therefore subject to change.
* Compilation of a source file using this routine requires that
feature macro _POSIX4_DRAFT_SOURCE be defined. This feature macro
is not enabled by any other feature macro, nor does it enable any
other feature macro.
* The compiled routine must be linked to library librte.a.
RETURN VALUE
If successful, semdestroy returns 0. If unsuccessful, it returns -1
and sets ERRNO to:
EINVAL sem is not valid.
SEE ALSO
seminit(2), semlock(2), semtrylock(2), semunlock(2),
semunlink(2).
Licensed material--property of copyright holder(s) 1