1SEM_CLOSE(P)               POSIX Programmer's Manual              SEM_CLOSE(P)
2
3
4

NAME

6       sem_close - close a named semaphore (REALTIME)
7

SYNOPSIS

9       #include <semaphore.h>
10
11       int sem_close(sem_t *sem);
12
13

DESCRIPTION

15       The  sem_close()  function  shall  indicate that the calling process is
16       finished using the named semaphore indicated by  sem.  The  effects  of
17       calling   sem_close()   for   an  unnamed  semaphore  (one  created  by
18       sem_init()) are undefined. The sem_close()  function  shall  deallocate
19       (that  is,  make available for reuse by a subsequent sem_open() by this
20       process) any system resources allocated by the system for use  by  this
21       process  for  this semaphore. The effect of subsequent use of the sema‐
22       phore indicated by sem by this process is undefined. If  the  semaphore
23       has  not  been  removed  with  a  successful call to sem_unlink(), then
24       sem_close() has no effect on  the  state  of  the  semaphore.   If  the
25       sem_unlink()  function has been successfully invoked for name after the
26       most recent call to sem_open() with O_CREAT for  this  semaphore,  then
27       when  all  processes that have opened the semaphore close it, the sema‐
28       phore is no longer accessible.
29

RETURN VALUE

31       Upon successful completion, a value of zero shall be  returned.  Other‐
32       wise,  a  value  of  -1 shall be returned and errno set to indicate the
33       error.
34

ERRORS

36       The sem_close() function shall fail if:
37
38       EINVAL The sem argument is not a valid semaphore descriptor.
39
40
41       The following sections are informative.
42

EXAMPLES

44       None.
45

APPLICATION USAGE

47       The sem_close() function is part of the Semaphores option and need  not
48       be available on all implementations.
49

RATIONALE

51       None.
52

FUTURE DIRECTIONS

54       None.
55

SEE ALSO

57       semctl()  , semget() , semop() , sem_init() , sem_open() , sem_unlink()
58       , the Base Definitions volume of IEEE Std 1003.1-2001, <semaphore.h>
59
61       Portions of this text are reprinted and reproduced in  electronic  form
62       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
63       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
64       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
65       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
66       event of any discrepancy between this version and the original IEEE and
67       The Open Group Standard, the original IEEE and The Open Group  Standard
68       is  the  referee document. The original Standard can be obtained online
69       at http://www.opengroup.org/unix/online.html .
70
71
72
73IEEE/The Open Group                  2003                         SEM_CLOSE(P)
Impressum