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 (REALTIME)
13

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

51       None.
52

APPLICATION USAGE

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

RATIONALE

58       None.
59

FUTURE DIRECTIONS

61       None.
62

SEE ALSO

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