summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_centermonitor.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /docs/nspr/reference/pr_centermonitor.rst
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/nspr/reference/pr_centermonitor.rst')
-rw-r--r--docs/nspr/reference/pr_centermonitor.rst57
1 files changed, 57 insertions, 0 deletions
diff --git a/docs/nspr/reference/pr_centermonitor.rst b/docs/nspr/reference/pr_centermonitor.rst
new file mode 100644
index 0000000000..8c135f844e
--- /dev/null
+++ b/docs/nspr/reference/pr_centermonitor.rst
@@ -0,0 +1,57 @@
+PR_CEnterMonitor
+================
+
+Enters the lock associated with a cached monitor.
+
+
+Syntax
+------
+
+.. code::
+
+ #include <prcmon.h>
+
+ PRMonitor* PR_CEnterMonitor(void *address);
+
+
+Parameter
+~~~~~~~~~
+
+The function has the following parameter:
+
+``address``
+ A reference to the data that is to be protected by the monitor. This
+ reference must remain valid as long as there are monitoring
+ operations being performed.
+
+
+Returns
+~~~~~~~
+
+The function returns one of the following values:
+
+- If successful, the function returns a pointer to the :ref:`PRMonitor`
+ associated with the value specified in the ``address`` parameter.
+- If unsuccessful (the monitor cache needs to be expanded and the
+ system is out of memory), the function returns ``NULL``.
+
+
+Description
+-----------
+
+:ref:`PR_CEnterMonitor` uses the value specified in the ``address``
+parameter to find a monitor in the monitor cache, then enters the lock
+associated with the monitor. If no match is found, an available monitor
+is associated with the address and the monitor's entry count is
+incremented (so it has a value of one). If a match is found, then either
+the calling thread is already in the monitor (and this is a reentrant
+call) or another thread is holding the monitor's mutex. In the former
+case, the entry count is simply incremented and the function returns. In
+the latter case, the calling thread is likely to find the monitor locked
+by another thread and waits for that thread to exit before continuing.
+
+.. note::
+
+ **Note**: :ref:`PR_CEnterMonitor` and :ref:`PR_CExitMonitor` must be
+ paired--that is, there must be an exit for every entry--or the object
+ will never become available for any other thread.