NXSemaWait

Acquires the resource protected by a semaphore, blocking if necessary.

Library:LibC
Classification:NKS
Service:Synchronization

Syntax

  #include <nks/synch.h>
   
  void NXSemaWait (
     NXSema_t  *sema);
  

Parameters

sema

(IN) Points to the semaphore to acquire.

Remarks

The NXSemaWait function decrements the semaphore value:

  • If the semaphore value is zero or greater, and the calling thread returns having acquired the resource.

  • If the semaphore value is negative, the calling thread blocks on the semaphore and waits until the resource is available.

For sample code, see Library.c.

See Also