OpenLocalSemaphore

Allocates a local semaphore and gives the NLM access to it

Local Servers:blocking
Remote Servers:N/A
Classification:3.x, 4.x, 5.x, 6.x
Service:Thread

Syntax

  #include <nwsemaph.h>  
   
  LONG OpenLocalSemaphore  (  
     LONG   initialValue); 
  

Parameters

initialValue
(IN) Specifies the value to assign the semaphore.

Return Values

If successful, returns a semaphore handle. On failure, returns zero.

Remarks

This function creates and initializes the semaphore to initialValue. The initialValue parameter indicates the number of threads that can access the resource at a time. A call to SignalLocalSemaphore increments this value. A call to WaitOnLocalSemaphore decrements this value.

WARNING:Developers must make sure to close local semaphores that are opened in an NLM because they are not automatically closed when an NLM unloads. If a local semaphore is opened but not closed before the NLM unloads, the server abends.

See Also

CloseLocalSemaphore, ExamineLocalSemaphore, SignalLocalSemaphore, TimedWaitOnLocalSemaphore, WaitOnLocalSemaphore