sem_destroy(PTHREAD)
sem_destroy --
destroy an unnamed semaphore
Synopsis
cc [options] -Kthread file
#include <semaphore.h>
int sem_destroy(sem_t *sem);
Description
sem_destroy destroys the
semaphore pointed to by sem.
This includes invalidating sem
and freeing any associated dynamically allocated
resources.
Only a semaphore that was
previously initialized by
sem_init may be destroyed using
sem_destroy;
It is safe to destroy an initialized 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
sem_destroy returns zero on success.
Otherwise, a value of -1 is returned and errno
is set to indicate the error.
Errors
sem_destroy returns the following value if the
corresponding condition is detected:
EINVAL-
The sem argument is not a valid semaphore.
EBUSY-
There are currently threads blocked on
the semaphore.
Standards compliance
The Single UNIX Specification, Version 2; The Open Group.
References
Intro(PTHREAD),
sem_init(PTHREAD),
sem_open(PTHREAD),
sem_post(PTHREAD),
sem_trywait(PTHREAD),
sem_wait(PTHREAD),
semaphore(F)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005