sem_close - close a named semaphore
#include <semaphore.h>
sem_close() is used to indicate that the calling thread is finished using the named semaphore sem. sem_close() deallocates any system resources for use by this thread for this semaphore. If the semaphore has not been removed with a successful call to sem_unlink(), then sem_close() has no effect on the state of the semaphore. If sem_unlink() has been successfully invoked for name after the most recent call to sem_open() with O_CREAT for this semaphore, then when all threads that have opened the semaphore close it, the semaphore will no longer be accessible.
sem_close() should not be called for an unnamed semaphore initialized by sem_init().
If successful, sem_close() returns 0, otherwise it returns -1 and sets errno to indicate the error condition.
sem_init(), sem_open(), sem_unlink()