close a named semaphore
cc [options] -Kthread file
int sem_close(sem_t *sem);
sem_close is used to indicate that the calling
process is finished using the named semaphore sem
(created by sem_open).
The effects of calling sem_close for
an unnamed semaphore (one created by sem_init)
sem_close deallocates any system resources allocated
by the system for use by this process for this semaphore.
(That is, it makes them available for reuse by a subsequent
sem_open by this process.)
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 the O_CREAT flag for this
then when all processes that have opened the semaphore
close it, the semaphore is no longer accessible.
sem_close returns zero on success.
Otherwise, a value of -1 is returned and errno
is set to indicate the error.
sem_close returns the following value if the
corresponding condition is detected:
The sem argument is not a valid semaphore descriptor.
The Single UNIX Specification, Version 2; The Open Group.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004