1sem_close(3)               Library Functions Manual               sem_close(3)
2
3
4

NAME

6       sem_close - close a named semaphore
7

LIBRARY

9       POSIX threads library (libpthread, -lpthread)
10

SYNOPSIS

12       #include <semaphore.h>
13
14       int sem_close(sem_t *sem);
15

DESCRIPTION

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

RETURN VALUE

22       On  success sem_close() returns 0; on error, -1 is returned, with errno
23       set to indicate the error.
24

ERRORS

26       EINVAL sem is not a valid semaphore.
27

ATTRIBUTES

29       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
30       tributes(7).
31
32       ┌────────────────────────────────────────────┬───────────────┬─────────┐
33Interface                                   Attribute     Value   
34       ├────────────────────────────────────────────┼───────────────┼─────────┤
35sem_close()                                 │ Thread safety │ MT-Safe │
36       └────────────────────────────────────────────┴───────────────┴─────────┘
37

STANDARDS

39       POSIX.1-2008.
40

HISTORY

42       POSIX.1-2001.
43

NOTES

45       All  open named semaphores are automatically closed on process termina‐
46       tion, or upon execve(2).
47

SEE ALSO

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.04              2023-03-30                      sem_close(3)
Impressum