sem_close(PTHREAD)
sem_close --
close a named semaphore
Synopsis
cc [options] -Kthread file
#include <semaphore.h>
int sem_close(sem_t *sem);
Description
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)
are undefined.
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
semaphore,
then when all processes that have opened the semaphore
close it, the semaphore is no longer accessible.
Return values
sem_close returns zero on success.
Otherwise, a value of -1 is returned and errno
is set to indicate the error.
Diagnostics
sem_close returns the following value if the
corresponding condition is detected:
EINVAL-
The sem argument is not a valid semaphore descriptor.
Standards compliance
The Single UNIX Specification, Version 2; The Open Group.
References
Intro(PTHREAD),
sem_init(PTHREAD),
sem_open(PTHREAD),
sem_unlink(PTHREAD),
semaphore(F)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005