1sem_close(3) Library Functions Manual sem_close(3)
2
3
4
6 sem_close - close a named semaphore
7
9 POSIX threads library (libpthread, -lpthread)
10
12 #include <semaphore.h>
13
14 int sem_close(sem_t *sem);
15
17 sem_close() closes the named semaphore referred to by sem, allowing any
18 resources that the system has allocated to the calling process for this
19 semaphore to be freed.
20
22 On success sem_close() returns 0; on error, -1 is returned, with errno
23 set to indicate the error.
24
26 EINVAL sem is not a valid semaphore.
27
29 For an explanation of the terms used in this section, see at‐
30 tributes(7).
31
32 ┌────────────────────────────────────────────┬───────────────┬─────────┐
33 │Interface │ Attribute │ Value │
34 ├────────────────────────────────────────────┼───────────────┼─────────┤
35 │sem_close() │ Thread safety │ MT-Safe │
36 └────────────────────────────────────────────┴───────────────┴─────────┘
37
39 POSIX.1-2008.
40
42 POSIX.1-2001.
43
45 All open named semaphores are automatically closed on process
46 termination, or upon execve(2).
47
49 sem_getvalue(3), sem_open(3), sem_post(3), sem_unlink(3), sem_wait(3),
50 sem_overview(7)
51
52
53
54Linux man-pages 6.05 2023-07-20 sem_close(3)