SEM_DESTROY(3) BSD Library Functions Manual SEM_DESTROY(3)NAME
sem_destroy -- destroy an unnamed semaphore
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <semaphore.h>
int
sem_destroy(sem_t *sem);
DESCRIPTION
The sem_destroy() function destroys the unnamed semaphore pointed to by sem. After a successful call to sem_destroy(), sem is unusable until
re-initialized by another call to sem_init(3).
RETURN VALUES
The sem_destroy() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to
indicate the error.
ERRORS
The sem_destroy() function will fail if:
[EINVAL] The sem argument points to an invalid semaphore.
[EBUSY] There are currently threads blocked on the semaphore that sem points to.
SEE ALSO sem_init(3)STANDARDS
The sem_destroy() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
POSIX does not define the behavior of sem_destroy() if called while there are threads blocked on sem, but this implementation is guaranteed
to return -1 and set errno to EBUSY if there are threads blocked on sem.
BSD February 15, 2000 BSD
Check Out this Related Man Page
sem_destroy(3C) Standard C Library Functions sem_destroy(3C)NAME
sem_destroy - destroy an unnamed semaphore
SYNOPSIS
#include <semaphore.h>
int sem_destroy(sem_t *sem);
DESCRIPTION
The sem_destroy() function is used to destroy the unnamed semaphore indicated by sem. Only a semaphore that was created using sem_init(3C)
may be destroyed using sem_destroy(); the effect of calling sem_destroy() with a named semaphore is undefined. The effect of subsequent use
of the semaphore sem is undefined until sem is re-initialized by another call to sem_init(3C).
It is safe to destroy an initialised semaphore upon which no threads are currently blocked. The effect of destroying a semaphore upon which
other threads are currently blocked is undefined.
RETURN VALUES
If successful, sem_destroy() returns 0, otherwise it returns -1 and sets errno to indicate the error.
ERRORS
The sem_destroy() function will fail if:
EINVAL The sem argument is not a valid semaphore.
The sem_destroy() function may fail if:
EBUSY There are currently processes (or LWPs or threads) blocked on the semaphore.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
|ATTRIBUTE TYPE |ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
|Standard |See standards(5). |
+-----------------------------+-----------------------------+
SEE ALSO sem_init(3C), sem_open(3C), attributes(5), standards(5)SunOS 5.11 5 Feb 2008 sem_destroy(3C)
Man Page
5 More Discussions You Might Find Interesting
1. Post Here to Contact Site Administrators and Moderators
I am attempting to write a program with multiple POSIX threads. I want to ensure all threads are released at the same time. I am (trying to) use a semaphore to accomplish this.
Without too much irrelevant information, I declare my semaphore with 0 of 25 resources available. Is there a way... (7 Replies)
Dear All,
I am receiving Fixed blocked file from AS/400 system to my unix box. Could you please advise us how to convert this fix blocked file to variable blocked file. Do we have any command in Unixt or program.
I am new to this Unix system
Thanks & Regards,
Colam (1 Reply)
Hi All,
I am searching for some files (*.sem and *.chk and *.temp) in morethan one directories.
if i found .sem and .chk files(base name should be same) i am deleting these 2 files because i need to delete .chk files if i found respective .sem file
i am also deleting other .sem files only... (6 Replies)
Hello All,
I have some files like file, file.chk, file.sem and file.temp in huge. I would like to delete some files based on following criteria.
1. Unconditionally delete .sem and .temp files
2. If we found the actual file, don't remove .chk file, otherwise remove .chk file as well
for... (5 Replies)