Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

OpenSolaris 2009.06 - man page for sem_destroy (opensolaris section 3c)

sem_destroy(3C) 					   Standard C Library Functions 					   sem_destroy(3C)

sem_destroy - destroy an unnamed semaphore
#include <semaphore.h> int sem_destroy(sem_t *sem);
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.
If successful, sem_destroy() returns 0, otherwise it returns -1 and sets errno to indicate the error.
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.
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+
sem_init(3C), sem_open(3C), attributes(5), standards(5) SunOS 5.11 5 Feb 2008 sem_destroy(3C)