sem_destroy

Frees the specified semaphore.

Library:LibC
Classification:POSIX
Service:Synchronization

Syntax

  #include <semaphore.h>
   
  int  sem_destroy  (
     sem_t   *sem );
  

Parameters

sem

(IN) Points to the semaphore to free.

Return Values

If successful, returns 0; otherwise, returns -1 and sets errno to one of the following values:

Decimal

Constant

Description

9

EINVAL

The sem parameter is invalid.

62

EBUSY

Threads are currently blocked on the specified semaphore.

Remarks

The semaphore being destroyed must have been allocated by calling sema_init.

See Also