Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Realtime Library Functionssem_destroy(3RT)


NAME

 sem_destroy - destroy an unnamed semaphore

SYNOPSIS

 
cc [ flag... ] file... -lrt [ library... ]
#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(3RT) 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(3RT).

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.
ENOSYS
The sem_destroy() function is not supported by the system.

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 TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

sem_init(3RT), sem_open(3RT), attributes(5)


SunOS 5.9Go To TopLast Changed 22 Jun 1998

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.