sem_close(2) SDK R4.11 sem_close(2)
NAME
semclose - close access to a named semaphore
SYNOPSIS
#include <semaphore.h>
int semclose (*sem)
semt *sem;
where:
sem A valid semaphore address returned by a prior semopen(2)
call.
DESCRIPTION
Use semclose(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 semopen(2).
Whenever a process calls exit(2) or exec(2), an implicit semclose(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 semunlink(2) to remove a
semaphore, the removal takes place as soon as the last of the
processes attached to the semaphore calls semclose(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, semclose returns 0. If unsuccessful, it returns -1
and sets ERRNO to:
EINVAL sem is not a valid named semaphore.
SEE ALSO
semopen(2), semwait(2), semtrywait(2), sempost(2), semunlink(2),
semdestroy(2).
Licensed material--property of copyright holder(s)