1SEM_DESTROY(3P)            POSIX Programmer's Manual           SEM_DESTROY(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_destroy — destroy an unnamed semaphore
13

SYNOPSIS

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

DESCRIPTION

20       The sem_destroy() function shall destroy the  unnamed  semaphore  indi‐
21       cated  by  sem.  Only a semaphore that was created using sem_init() may
22       be destroyed using sem_destroy(); the effect of  calling  sem_destroy()
23       with  a  named  semaphore is undefined. The effect of subsequent use of
24       the semaphore sem is undefined until sem is  reinitialized  by  another
25       call to sem_init().
26
27       It  is  safe  to destroy an initialized semaphore upon which no threads
28       are currently blocked. The effect of destroying a semaphore upon  which
29       other threads are currently blocked is undefined.
30

RETURN VALUE

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

ERRORS

37       The sem_destroy() function may fail if:
38
39       EINVAL The sem argument is not a valid semaphore.
40
41       EBUSY  There are currently processes blocked on the semaphore.
42
43       The following sections are informative.
44

EXAMPLES

46       None.
47

APPLICATION USAGE

49       None.
50

RATIONALE

52       None.
53

FUTURE DIRECTIONS

55       None.
56

SEE ALSO

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