NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO
cc [ flag... ] file... -lrt [ library... ] $(OS_DIR)/lib/libc.a #include <semaphore.h>int sem_close(sem_t *sem);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The sem_close() function is used to indicate that the calling process is finished using the named semaphore indicated by sem. The sem_close() function deallocates (that is, makes available for reuse by a subsequent sem_open(3POSIX)) any system resources allocated by the system for use by this process for this semaphore. The effect of subsequent use of the semaphore indicated by sem by this process is undefined. If the semaphore has not been removed with a successful call to sem_unlink(3POSIX), sem_close() has no effect on the state of the semaphore. If the sem_unlink(3POSIX) function has been successfully invoked for name after the most recent call to sem_open(3POSIX) with O_CREAT for this semaphore, when all processes that have opened the semaphore close it, the semaphore is no longer be accessible.
If successful, sem_close() returns 0, otherwise it returns -1 and sets errno to indicate the error.
The sem_close() function will fail if:
The sem argument is not a valid semaphore descriptor.
The sem_close() function is not supported by the system.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO