NXSemaInit

Initializes a semaphore.

Library:LibC
Classification:NKS
Service:Synchronization

Syntax

  #include <nks/synch.h>
   
  int NXSemaInit (
     NXSema_t      *sema, 
     unsigned int   count, 
     void          *arg);
  

Parameters

sema

(IN) Points to the semaphore to initialize.

count

(IN) Specifies the number of resources that the semaphore will protect and control.

arg

(IN) Reserved for future use. Set to NULL.

Return Values

If successful, returns zero; otherwise, returns a nonzero error code:

Decimal

Hex

Constant

Description

5

0x05

NX_ENOMEM

Insufficient memory to complete this call.

Remarks

Semaphores can be used to control access to a set of resources.

If you call NXSemaInit on a previously initialized semaphore, no warning is given unless you are in DEBUG mode.

See Also