diff options
Diffstat (limited to 'devdocs/elisp/mutexes.html')
| -rw-r--r-- | devdocs/elisp/mutexes.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/mutexes.html b/devdocs/elisp/mutexes.html new file mode 100644 index 00000000..094c6247 --- /dev/null +++ b/devdocs/elisp/mutexes.html @@ -0,0 +1,18 @@ + <h3 class="section">Mutexes</h3> <p>A <em>mutex</em> is an exclusive lock. At any moment, zero or one threads may own a mutex. If a thread attempts to acquire a mutex, and the mutex is already owned by some other thread, then the acquiring thread will block until the mutex becomes available. </p> <p>Emacs Lisp mutexes are of a type called <em>recursive</em>, which means that a thread can re-acquire a mutex it owns any number of times. A mutex keeps a count of how many times it has been acquired, and each acquisition of a mutex must be paired with a release. The last release by a thread of a mutex reverts it to the unowned state, potentially allowing another thread to acquire the mutex. </p> <dl> <dt id="mutexp">Function: <strong>mutexp</strong> <em>object</em> +</dt> <dd><p>This function returns <code>t</code> if <var>object</var> represents an Emacs mutex, <code>nil</code> otherwise. </p></dd> +</dl> <dl> <dt id="make-mutex">Function: <strong>make-mutex</strong> <em>&optional name</em> +</dt> <dd><p>Create a new mutex and return it. If <var>name</var> is specified, it is a name given to the mutex. It must be a string. The name is for debugging purposes only; it has no meaning to Emacs. </p></dd> +</dl> <dl> <dt id="mutex-name">Function: <strong>mutex-name</strong> <em>mutex</em> +</dt> <dd><p>Return the name of <var>mutex</var>, as specified to <code>make-mutex</code>. </p></dd> +</dl> <dl> <dt id="mutex-lock">Function: <strong>mutex-lock</strong> <em>mutex</em> +</dt> <dd><p>This will block until this thread acquires <var>mutex</var>, or until this thread is signaled using <code>thread-signal</code>. If <var>mutex</var> is already owned by this thread, this simply returns. </p></dd> +</dl> <dl> <dt id="mutex-unlock">Function: <strong>mutex-unlock</strong> <em>mutex</em> +</dt> <dd><p>Release <var>mutex</var>. If <var>mutex</var> is not owned by this thread, this will signal an error. </p></dd> +</dl> <dl> <dt id="with-mutex">Macro: <strong>with-mutex</strong> <em>mutex body…</em> +</dt> <dd><p>This macro is the simplest and safest way to evaluate forms while holding a mutex. It acquires <var>mutex</var>, invokes <var>body</var>, and then releases <var>mutex</var>. It returns the result of <var>body</var>. </p></dd> +</dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Mutexes.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Mutexes.html</a> + </p> +</div> |
