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

NAME

6       sem_destroy - destroy an unnamed semaphore (REALTIME)
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

27       Upon successful completion, a value of zero shall be  returned.  Other‐
28       wise,  a  value  of  -1 shall be returned and errno set to indicate the
29       error.
30

ERRORS

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

EXAMPLES

45       None.
46

APPLICATION USAGE

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

RATIONALE

52       None.
53

FUTURE DIRECTIONS

55       None.
56

SEE ALSO

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