1SEM_CLOSE(3) Linux Programmer's Manual SEM_CLOSE(3)
2
3
4
6 sem_close - close a named semaphore
7
9 #include <semaphore.h>
10
11 int sem_close(sem_t *sem);
12
13 Link with -pthread.
14
16 sem_close() closes the named semaphore referred to by sem, allowing any
17 resources that the system has allocated to the calling process for this
18 semaphore to be freed.
19
21 On success sem_close() returns 0; on error, -1 is returned, with errno
22 set to indicate the error.
23
25 EINVAL sem is not a valid semaphore.
26
28 For an explanation of the terms used in this section, see
29 attributes(7).
30
31 ┌────────────┬───────────────┬─────────┐
32 │Interface │ Attribute │ Value │
33 ├────────────┼───────────────┼─────────┤
34 │sem_close() │ Thread safety │ MT-Safe │
35 └────────────┴───────────────┴─────────┘
36
38 POSIX.1-2001, POSIX.1-2008.
39
41 All open named semaphores are automatically closed on process termina‐
42 tion, or upon execve(2).
43
45 sem_getvalue(3), sem_open(3), sem_post(3), sem_unlink(3), sem_wait(3),
46 sem_overview(7)
47
49 This page is part of release 4.15 of the Linux man-pages project. A
50 description of the project, information about reporting bugs, and the
51 latest version of this page, can be found at
52 https://www.kernel.org/doc/man-pages/.
53
54
55
56Linux 2017-09-15 SEM_CLOSE(3)