Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sem_destroy(3) [freebsd man page]

SEM_DESTROY(3)						   BSD Library Functions Manual 					    SEM_DESTROY(3)

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(3)						     Library Functions Manual						    sem_destroy(3)

sem_destroy - Destroys an unnamed semaphore (P1003.1b) LIBRARY
Realtime Library (, librt.a) SYNOPSIS
#include <semaphore.h> int sem_destroy ( sem_t *sem); PARAMETERS
sem References the unnamed semaphore to be destroyed. Use the sem argument that was supplied to, and filled in by, the previous call to sem_init. DESCRIPTION
The sem_destroy function destroys an unnamed semaphore indicated by sem. Only a semaphore created using sem_init may be destroyed using sem_destroy. The potential for deadlock exists if a process calls sem_destroy for a semaphore while there is a pending sem_wait, because a process may be waiting for a poster that has not yet opened the semaphore. RETURN VALUES
On successful completion, the function returns the value 0 (zero); otherwise, the function returns the value -1 and sets errno to indicate the error, without destroying the semaphore indicated by the sem argument. ERRORS
The sem_destroy function fails under the following condition: [EINVAL] The sem argument is not a valid semaphore. RELATED INFORMATION
Functions: sem_init(3), sem_open(3) Guide to Realtime Programming delim off sem_destroy(3)
Man Page

5 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators


Has any thought been given to assigning points to threads much in the way the HP ITRC forums do? This might not be possible, just a thought. (1 Reply)
Discussion started by: candlejack
1 Replies

2. Programming

Posix Semaphore Use - Releasing all resources?

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)
Discussion started by: snowbarr
7 Replies

3. UNIX for Advanced & Expert Users

Convert variable blocked file

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)
Discussion started by: coolmaninit
1 Replies

4. Shell Programming and Scripting

Controller is not going into IF test

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)
Discussion started by: VasuKukkapalli
6 Replies

5. Shell Programming and Scripting

Conditional deletion of files based on extension

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)
Discussion started by: VasuKukkapalli
5 Replies