Deallocates the specified named semaphore. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <semaphore.h> int sem_close (sem_t *sem);
1 – Argument
sem The semaphore to be closed. Use the sem argument returned by the previous call to sem_open.
2 – Description
The sem_close function makes a semaphore available for reuse by deallocating any system resources allocated for use by the current process for the named semaphore indicated by sem. If the semaphore has not been removed with a call to sem_unlink, sem_close does not change the current state of the semaphore. If the semaphore has been removed with a call to sem_unlink after the most recent call to sem_open with O_CREAT, the semaphore is no longer available after all processes that opened the semaphore close it.
3 – Return Values
0 Successful completion. -1 Indicates an error. The function sets errno to one of the following values: o EINVAL - The sem argument is not a valid semaphore descriptor. o ENOSYS - The function is not implemented. o EVMSERR - OpenVMS specific nontranslatable error code.