NXSemaAlloc

Allocates and initializes a semaphore.

Library:LibC
Classification:NKS
Service:Synchronization

Syntax

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

Parameters

count

(IN) Specifies the number of instances of a given resources to be protected by the semaphore.

arg

(IN) Is reserved for future use. Set to NULL.

Return Values

If successful, returns a pointer to the allocated and initialized semaphore; otherwise, returns a NULL pointer.

Remarks

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

The NXSemaAlloc function allocates and initializes the semaphore. Do not call NXSemaInit to initialize the semaphore.

For sample code, see Library.c.

See Also