ExamineLocalSemaphore

Returns the current value of a local semaphore

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

Syntax

  #include <nwsemaph.h>  
   
  int ExamineLocalSemaphore  (  
     LONG   semaphoreHandle); 
  

Parameters

semaphoreHandle
(IN) Specifies the semaphore handle of an open semaphore.

Return Values

If successful, this function returns the current value of a semaphore.

WARNING:If a bad semaphore handle is specified, the server abends.

Remarks

This function returns the current value of a semaphore. The semaphore value is decremented for each WaitOnLocalSemaphore and incremented for each SignalLocalSemaphore. A positive semaphore value indicates that the thread can access the associated resource. If the semaphore value is zero or negative, the thread must either enter a waiting queue by calling the function WaitOnLocalSemaphore, or temporarily abandon its attempt to access the resource.

A semaphore handle is obtained by calling OpenLocalSemaphore.

See Also

CloseLocalSemaphore, OpenLocalSemaphore, SignalLocalSemaphore, TimedWaitOnLocalSemaphore, WaitOnLocalSemaphore