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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       sem_close - close a named semaphore (REALTIME)
13

SYNOPSIS

15       #include <semaphore.h>
16
17       int sem_close(sem_t *sem);
18
19

DESCRIPTION

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

RETURN VALUE

37       Upon  successful  completion, a value of zero shall be returned. Other‐
38       wise, a value of -1 shall be returned and errno  set  to  indicate  the
39       error.
40

ERRORS

42       The sem_close() function shall fail if:
43
44       EINVAL The sem argument is not a valid semaphore descriptor.
45
46
47       The following sections are informative.
48

EXAMPLES

50       None.
51

APPLICATION USAGE

53       The  sem_close() function is part of the Semaphores option and need not
54       be available on all implementations.
55

RATIONALE

57       None.
58

FUTURE DIRECTIONS

60       None.
61

SEE ALSO

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