cached_monitors.rst (1553B)
1 This chapter describes the functions you use when you work with cached 2 monitors. Unlike a plain monitor, a cached monitor is associated with 3 the address of a protected object, and the association is maintained 4 only while the protection is needed. This arrangement allows a cached 5 monitor to be associated with another object without preallocating a 6 monitor for all objects. A hash table is used to quickly map addresses 7 to their respective monitors. The system automatically enlarges the hash 8 table as needed. 9 10 Important 11 --------- 12 13 Cached monitors are slower to use than their uncached counterparts. 14 15 See `Monitors <Monitors>`__ for information about uncached monitors. 16 17 .. _Cached_Monitors_Functions: 18 19 Cached Monitors Functions 20 ------------------------- 21 22 Cached monitors allow the client to associate monitoring protection and 23 state change synchronization in a lazy fashion. The monitoring 24 capability is associated with the protected object only during the time 25 it is required, allowing the monitor object to be reused. This 26 additional flexibility comes at the cost of a small loss in performance. 27 28 - :ref:`PR_CEnterMonitor` enters the lock associated with a cached 29 monitor. 30 - :ref:`PR_CExitMonitor` decrements the entry count associated with a 31 cached monitor. 32 - :ref:`PR_CWait` waits for a notification that a monitor's state has 33 changed. 34 - :ref:`PR_CNotify` notifies a thread waiting for a change in the state of 35 monitored data. 36 - :ref:`PR_CNotifyAll` notifies all the threads waiting for a change in 37 the state of monitored data.