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
13

SYNOPSIS

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

DESCRIPTION

20       The sem_close() function shall indicate that  the  calling  process  is
21       finished  using  the  named semaphore indicated by sem.  The effects of
22       calling  sem_close()  for  an  unnamed  semaphore   (one   created   by
23       sem_init())  are  undefined.  The sem_close() function shall deallocate
24       (that is, make available for reuse by a subsequent sem_open()  by  this
25       process)  any  system resources allocated by the system for use by this
26       process for this semaphore. The effect of subsequent use of  the  sema‐
27       phore  indicated by sem by this process is undefined. If any threads in
28       the calling process are currently blocked on the semaphore, the  behav‐
29       ior  is  undefined.   If the semaphore has not been removed with a suc‐
30       cessful call to sem_unlink(), then sem_close() has  no  effect  on  the
31       state  of the semaphore. If the sem_unlink() function has been success‐
32       fully invoked for name after the most recent call  to  sem_open()  with
33       O_CREAT  for  this  semaphore, then when all processes that have opened
34       the semaphore close it, the semaphore 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 may fail if:
43
44       EINVAL The sem argument is not a valid semaphore descriptor.
45
46       The following sections are informative.
47

EXAMPLES

49       None.
50

APPLICATION USAGE

52       None.
53

RATIONALE

55       None.
56

FUTURE DIRECTIONS

58       None.
59

SEE ALSO

61       semctl(), semget(), semop(), sem_init(), sem_open(), sem_unlink()
62
63       The Base Definitions volume of POSIX.1‐2017, <semaphore.h>
64
66       Portions of this text are reprinted and reproduced in  electronic  form
67       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
68       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
69       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
70       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
71       event of any discrepancy between this version and the original IEEE and
72       The Open Group Standard, the original IEEE and The Open Group  Standard
73       is  the  referee document. The original Standard can be obtained online
74       at http://www.opengroup.org/unix/online.html .
75
76       Any typographical or formatting errors that appear  in  this  page  are
77       most likely to have been introduced during the conversion of the source
78       files to man page format. To report such errors,  see  https://www.ker
79       nel.org/doc/man-pages/reporting_bugs.html .
80
81
82
83IEEE/The Open Group                  2017                        SEM_CLOSE(3P)
Impressum