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)

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(3)						     Linux Programmer's Manual						    SEM_DESTROY(3)

NAME
sem_destroy - destroy an unnamed semaphore SYNOPSIS
#include <semaphore.h> int sem_destroy(sem_t *sem); Link with -pthread. DESCRIPTION
sem_destroy() destroys the unnamed semaphore at the address pointed to by sem. Only a semaphore that has been initialized by sem_init(3) should be destroyed using sem_destroy(). Destroying a semaphore that other processes or threads are currently blocked on (in sem_wait(3)) produces undefined behavior. Using a semaphore that has been destroyed produces undefined results, until the semaphore has been reinitialized using sem_init(3). RETURN VALUE
sem_destroy() returns 0 on success; on error, -1 is returned, and errno is set to indicate the error. ERRORS
EINVAL sem is not a valid semaphore. CONFORMING TO
POSIX.1-2001. NOTES
An unnamed semaphore should be destroyed with sem_destroy() before the memory in which it is located is deallocated. Failure to do this can result in resource leaks on some implementations. SEE ALSO
sem_init(3), sem_post(3), sem_wait(3), sem_overview(7) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2012-05-13 SEM_DESTROY(3)
Man Page

5 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Points?

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