1sem_destroy(3C)          Standard C Library Functions          sem_destroy(3C)
2
3
4

NAME

6       sem_destroy - destroy an unnamed semaphore
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUES

28       If successful, sem_destroy() returns 0, otherwise  it  returns  −1  and
29       sets errno to indicate the error.
30

ERRORS

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

ATTRIBUTES

45       See attributes(5) for descriptions of the following attributes:
46
47
48
49
50       ┌─────────────────────────────┬─────────────────────────────┐
51       │ATTRIBUTE TYPE               │ATTRIBUTE VALUE              │
52       ├─────────────────────────────┼─────────────────────────────┤
53       │Interface Stability          │Committed                    │
54       ├─────────────────────────────┼─────────────────────────────┤
55       │MT-Level                     │MT-Safe                      │
56       ├─────────────────────────────┼─────────────────────────────┤
57       │Standard                     │See standards(5).            │
58       └─────────────────────────────┴─────────────────────────────┘
59

SEE ALSO

61       sem_init(3C), sem_open(3C), attributes(5), standards(5)
62
63
64
65SunOS 5.11                        5 Feb 2008                   sem_destroy(3C)
Impressum