DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sema_destroy(SYNCH)


sema_destroy -- destroy a semaphore

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int sema_destroy(sema_t *sema);

Description

sema_destroy destroys the semaphore pointed to by sema. This includes invalidating sema and freeing any associated dynamically allocated resources.

Parameters


sema
pointer to the semaphore to destroy

sema parameter

sema must have been previously initialized, either by sema_init or statically (see sema_init(SYNCH)).

Return values

sema_destroy returns zero for success and an error number for failure.

Errors

If any of the following conditions is detected, sema_destroy returns the corresponding value:

EBUSY
sema still has threads waiting

EINVAL
invalid argument specified

References

Intro(SYNCH), semaphore(SYNCH), sema_init(SYNCH), sema_post(SYNCH), sema_trywait(SYNCH), sema_wait(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005