Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sem_close(3R) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sem_init(3R)

sem_open(3R)

sem_unlink(3R)

attributes(5)

sem_close(3R)

NAME

sem_close − close a named semaphore

SYNOPSIS

cc [ flag ... ] file ... −lposix4 [ library ... ]

#include <semaphore.h>

int sem_close(sem_t ∗sem);

DESCRIPTION

The sem_close() function is used to indicate that the calling process is finished using the named semaphore sem. It deallocates any system resources for use by this process for this semaphore. If the semaphore has not been removed with a successful call to sem_unlink(3R), then sem_close() has no effect on the state of the semaphore.  If sem_unlink(3R) has been successfully invoked for name after the most recent call to sem_open(3R) with O_CREAT for this semaphore, then when all processes that have opened the semaphore close it, the semaphore will no longer be accessible. 

The sem_close() function should not be called for an unnamed semaphore initialized by sem_init(3R). 

RETURN VALUES

If successful, sem_close() returns 0, otherwise it returns −1 and sets errno to indicate the error condition. 

ERRORS

EINVAL The sem argument is not a valid semaphore descriptor. 

ENOSYS The sem_close() function is not supported by this implementation. 

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level MT-Safe

SEE ALSO

sem_init(3R), sem_open(3R), sem_unlink(3R), attributes(5)

SunOS 5.6  —  Last change: 30 Dec 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026