sema_post

Releases the resource protected by the specified semaphore.

Library:LibC
Classification:UNIX International
Service:Synchronization

Syntax

  #include <synch.h>
   
  int   sema_post (
     sema_t   *sp );
  

Parameters

sp

(IN) Points to the semaphore to signal.

Return Values

Returns 0. If the sem parameter points to an invalid semaphore, the function does nothing and returns 0. If the sem parameter points to a valid semaphore, the function increments the semaphore value and returns 0.

Remarks

The sem_post function increments the semaphore value. If a thread is waiting for the semaphore, it makes the blocked thread runnable. If multiple threads are blocked on the semaphore, no assumptions can be made about which of those threads might be unblocked.

See Also