SEM_CLOSE(3) Linux Programmer's Manual SEM_CLOSE(3)NAME
sem_close - close a named semaphore
SYNOPSIS
#include <semaphore.h>
int sem_close(sem_t *sem);
Link with -pthread.
DESCRIPTION
sem_close() closes the named semaphore referred to by sem, allowing any resources that the system has allocated to the calling process for
this semaphore to be freed.
RETURN VALUE
On success sem_close() returns 0; on error, -1 is returned, with errno set to indicate the error.
ERRORS
EINVAL sem is not a valid semaphore.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+------------+---------------+---------+
|Interface | Attribute | Value |
+------------+---------------+---------+
|sem_close() | Thread safety | MT-Safe |
+------------+---------------+---------+
CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
NOTES
All open named semaphores are automatically closed on process termination, or upon execve(2).
SEE ALSO sem_getvalue(3), sem_open(3), sem_post(3), sem_unlink(3), sem_wait(3), sem_overview(7)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2017-09-15 SEM_CLOSE(3)
Check Out this Related Man Page
SEM_CLOSE(3) Linux Programmer's Manual SEM_CLOSE(3)NAME
sem_close - close a named semaphore
SYNOPSIS
#include <semaphore.h>
int sem_close(sem_t *sem);
Link with -pthread.
DESCRIPTION
sem_close() closes the named semaphore referred to by sem, allowing any resources that the system has allocated to the calling process for
this semaphore to be freed.
RETURN VALUE
On success sem_close() returns 0; on error, -1 is returned, with errno set to indicate the error.
ERRORS
EINVAL sem is not a valid semaphore.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+------------+---------------+---------+
|Interface | Attribute | Value |
+------------+---------------+---------+
|sem_close() | Thread safety | MT-Safe |
+------------+---------------+---------+
CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
NOTES
All open named semaphores are automatically closed on process termination, or upon execve(2).
SEE ALSO sem_getvalue(3), sem_open(3), sem_post(3), sem_unlink(3), sem_wait(3), sem_overview(7)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2017-09-15 SEM_CLOSE(3)
I can't compile these codes with g++.
my system is linux (kernel is 2.4.0 ).
When I try to compile this program with g++ -o semw semw.cpp
It always tells me that sem_open sem_close,sem_post do not exist.But I have checked semaphore.h,I can not find any problems.
Anyone can compile these codes... (2 Replies)
Hi,
I am trying to write stuff to a shared memory using a writer, and reading the corresponding stuff using a reader. I am facing problems while releasing the lock, as a result of which I am having segmentation faults. The code is as follows...
/********** writer.c ***********/
... (1 Reply)
I am on HP-UX delta B.11.11
I am using sem_open() and compiling/linking the library by specifying -lrt.
Then, I am creating library like below:
ar cr $libdir/liboscfe.a `cat fe.libs.$$ com.libs.$$`
ranlib $libdir/liboscfe.a
Now, I am compiling another utility sch2db which requires this... (1 Reply)
I want to build a little website on a Sun Blade 100 running Solaris 10.
I just went out to apache.org and downloaded Unix Source: httpd-2.2.8.tar.gz
After unpacking the tarball, I CD'd into the subdirectory and ran the configure utility. Of course, it crapped out. I see that it is... (17 Replies)
Hi
We meet errors while running configuration scripts to prepare compiling source code on AIX 7.2. This error does not happen on AIX5.3 and AIX6.1
With the “/usr/bin/sh” from AIX7.2, sometimes , the script runs sucessfully, sometimes not. It’s unstable, and I don’t know why.
When... (10 Replies)