sema_destroy(3synch)


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(3synch)).

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(3synch), semaphore(3synch), sema_init(3synch), sema_post(3synch), sema_trywait(3synch), sema_wait(3synch)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004