WaitOnLocalSemaphore

Decrements the semaphore value of the specified semaphore

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

Syntax

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

Parameters

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

Return Values

If successful, this function returns zero.

WARNING:A bad semaphore handle causes the server to abend.

Remarks

A thread would typically call this function before accessing the resource associated with the semaphore. An NLM can also use this function to cause a thread to wait until another thread signals it to resume.

If the semaphore value is still greater than or equal to zero after the function decrements it, the thread is not suspended. If the semaphore value is negative, the thread is suspended until the semaphore is signalled one more time than there are threads ahead of the current thread on the specified semaphore’s queue.

A semaphore handle can be obtained by calling OpenLocalSemaphore.

See Also

CloseLocalSemaphore, ExamineLocalSemaphore, OpenLocalSemaphore, SignalLocalSemaphore, TimedWaitOnLocalSemaphore