pr_entermonitor.rst (1091B)
1 PR_EnterMonitor 2 =============== 3 4 Enters the lock associated with a specified monitor. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prmon.h> 13 14 void PR_EnterMonitor(PRMonitor *mon); 15 16 17 Parameter 18 ~~~~~~~~~ 19 20 The function has the following parameter: 21 22 ``mon`` 23 A reference to an existing structure of type :ref:`PRMonitor`. 24 25 26 Description 27 ----------- 28 29 When the calling thread returns, it will have acquired the monitor's 30 lock. Attempts to acquire the lock for a monitor that is held by some 31 other thread will result in the caller blocking. The operation is 32 neither timed nor interruptible. 33 34 If the monitor's entry count is greater than zero and the calling thread 35 is recognized as the holder of the lock, :ref:`PR_EnterMonitor` increments 36 the entry count by one and returns. If the entry count is greater than 37 zero and the calling thread is not recognized as the holder of the lock, 38 the thread is blocked until the entry count reaches zero. When the entry 39 count reaches zero (or if it is already zero), the entry count is 40 incremented by one and the calling thread is recorded as the lock's 41 holder.