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 sem_destroy (*sem)
sem_t *sem;
DESCRIPTION
Use sem_destroy(2) to indicate that your process is finished using a
semaphore: sem is a valid semaphore descriptor returned by a prior
sem_init(2) call. After making this call, your process cannot again
access sem without first calling sem_init(2).
Whenever a process calls exit(2) or exec(2), an implicit sem_destroy
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
sem_unlink(2) to remove a semaphore, the removal takes place as soon
as the last of the processes attached to the semaphore calls
sem_destroy(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, sem_destroy returns 0. If unsuccessful, it returns -1
and sets ERRNO to:
EINVAL sem is not valid.
SEE ALSO
sem_init(2), sem_lock(2), sem_trylock(2), sem_unlock(2),
sem_unlink(2).
Licensed material--property of copyright holder(s) 1