pr_waitsemaphore.rst (784B)
1 PR_WaitSemaphore 2 ================ 3 4 Returns the value of the environment variable. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <pripcsem.h> 13 14 NSPR_API(PRStatus) PR_WaitSemaphore(PRSem *sem); 15 16 17 Parameter 18 ~~~~~~~~~ 19 20 The function has the following parameter: 21 22 ``sem`` 23 A pointer to a ``PRSem`` structure returned from a call to 24 :ref:`PR_OpenSemaphore`. 25 26 27 Returns 28 ~~~~~~~ 29 30 :ref:`PRStatus` 31 32 33 Description 34 ----------- 35 36 :ref:`PR_WaitSemaphore` tests the value of the semaphore. If the value of 37 the semaphore is > 0, the value of the semaphore is decremented and the 38 function returns. If the value of the semaphore is 0, the function 39 blocks until the value becomes > 0, then the semaphore is decremented 40 and the function returns. 41 42 The "test and decrement" operation is performed atomically.