sem_close(2) DG/UX R4.11MU05 sem_close(2)
NAME
sem_close - close access to a named semaphore
SYNOPSIS
#include <semaphore.h>
int sem_close (*sem)
sem_t *sem;
where:
sem A valid semaphore address returned by a prior sem_open(2)
call.
DESCRIPTION
Use sem_close(2) to indicate that your process is finished using a
semaphore.
After making this call, your process cannot again access the
semaphore indicated by sem without first calling sem_open(2).
Whenever a process calls exit(2) or exec(2), an implicit sem_close(2)
is made on all its named semaphores.
This call closes 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_close(2), exit(2), or
exec(2).
Note
* This routine is based on POSIX realtime extension document P1003.4
draft 14. 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_close returns 0. If unsuccessful, it returns -1
and sets ERRNO to:
EINVAL sem is not a valid named semaphore.
SEE ALSO
sem_open(2), sem_wait(2), sem_trywait(2), sem_post(2), sem_unlink(2),
sem_destroy(2).
Licensed material--property of copyright holder(s)