pr_notifycondvar.rst (1211B)
1 PR_NotifyCondVar 2 ================ 3 4 Notifies a condition variable of a change in its associated monitored 5 data. 6 7 8 Syntax 9 ------ 10 11 .. code:: 12 13 #include <prcvar.h> 14 15 PRStatus PR_NotifyCondVar(PRCondVar *cvar); 16 17 18 Parameter 19 ~~~~~~~~~ 20 21 :ref:`PR_NotifyCondVar` has one parameter: 22 23 ``cvar`` 24 The condition variable to notify. 25 26 27 Returns 28 ~~~~~~~ 29 30 The function returns one of the following values: 31 32 - If successful, ``PR_SUCCESS``. 33 - If unsuccessful (for example, if the caller has not locked the lock 34 associated with the condition variable), ``PR_FAILURE``. 35 36 37 Description 38 ----------- 39 40 The calling thread must hold the lock that protects the condition, as 41 well as the invariants that are tightly bound to the condition. 42 43 Notification of a condition variable signals a change of state in some 44 monitored data. When the notification occurs, the runtime promotes a 45 thread that is waiting on the condition variable to a ready state. If 46 more than one thread is waiting, the selection of which thread gets 47 promoted cannot be predicted. This implies that all threads waiting on a 48 single condition variable must have the same semantics. If no thread is 49 waiting on the condition variable, the notify operation is a no-op.