summaryrefslogtreecommitdiff
path: root/devdocs/elisp/basic-thread-functions.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/basic-thread-functions.html
new repository
Diffstat (limited to 'devdocs/elisp/basic-thread-functions.html')
-rw-r--r--devdocs/elisp/basic-thread-functions.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/devdocs/elisp/basic-thread-functions.html b/devdocs/elisp/basic-thread-functions.html
new file mode 100644
index 00000000..f96cc7be
--- /dev/null
+++ b/devdocs/elisp/basic-thread-functions.html
@@ -0,0 +1,36 @@
+ <h3 class="section">Basic Thread Functions</h3> <p>Threads can be created and waited for. A thread cannot be exited directly, but the current thread can be exited implicitly, and other threads can be signaled. </p> <dl> <dt id="make-thread">Function: <strong>make-thread</strong> <em>function &amp;optional name</em>
+</dt> <dd>
+<p>Create a new thread of execution which invokes <var>function</var>. When <var>function</var> returns, the thread exits. </p> <p>The new thread is created with no local variable bindings in effect. The new thread’s current buffer is inherited from the current thread. </p> <p><var>name</var> can be supplied to give a name to the thread. The name is used for debugging and informational purposes only; it has no meaning to Emacs. If <var>name</var> is provided, it must be a string. </p> <p>This function returns the new thread. </p>
+</dd>
+</dl> <dl> <dt id="threadp">Function: <strong>threadp</strong> <em>object</em>
+</dt> <dd><p>This function returns <code>t</code> if <var>object</var> represents an Emacs thread, <code>nil</code> otherwise. </p></dd>
+</dl> <dl> <dt id="thread-join">Function: <strong>thread-join</strong> <em>thread</em>
+</dt> <dd><p>Block until <var>thread</var> exits, or until the current thread is signaled. It returns the result of the <var>thread</var> function. If <var>thread</var> has already exited, this returns immediately. </p></dd>
+</dl> <dl> <dt id="thread-signal">Function: <strong>thread-signal</strong> <em>thread error-symbol data</em>
+</dt> <dd>
+<p>Like <code>signal</code> (see <a href="signaling-errors">Signaling Errors</a>), but the signal is delivered in the thread <var>thread</var>. If <var>thread</var> is the current thread, then this just calls <code>signal</code> immediately. Otherwise, <var>thread</var> will receive the signal as soon as it becomes current. If <var>thread</var> was blocked by a call to <code>mutex-lock</code>, <code>condition-wait</code>, or <code>thread-join</code>; <code>thread-signal</code> will unblock it. </p> <p>If <var>thread</var> is the main thread, the signal is not propagated there. Instead, it is shown as message in the main thread. </p>
+</dd>
+</dl> <dl> <dt id="thread-yield">Function: <strong>thread-yield</strong>
+</dt> <dd><p>Yield execution to the next runnable thread. </p></dd>
+</dl> <dl> <dt id="thread-name">Function: <strong>thread-name</strong> <em>thread</em>
+</dt> <dd><p>Return the name of <var>thread</var>, as specified to <code>make-thread</code>. </p></dd>
+</dl> <dl> <dt id="thread-live-p">Function: <strong>thread-live-p</strong> <em>thread</em>
+</dt> <dd><p>Return <code>t</code> if <var>thread</var> is alive, or <code>nil</code> if it is not. A thread is alive as long as its function is still executing. </p></dd>
+</dl> <dl> <dt id="thread--blocker">Function: <strong>thread--blocker</strong> <em>thread</em>
+</dt> <dd>
+<p>Return the object that <var>thread</var> is waiting on. This function is primarily intended for debugging, and is given a “double hyphen” name to indicate that. </p> <p>If <var>thread</var> is blocked in <code>thread-join</code>, this returns the thread for which it is waiting. </p> <p>If <var>thread</var> is blocked in <code>mutex-lock</code>, this returns the mutex. </p> <p>If <var>thread</var> is blocked in <code>condition-wait</code>, this returns the condition variable. </p> <p>Otherwise, this returns <code>nil</code>. </p>
+</dd>
+</dl> <dl> <dt id="current-thread">Function: <strong>current-thread</strong>
+</dt> <dd><p>Return the current thread. </p></dd>
+</dl> <dl> <dt id="all-threads">Function: <strong>all-threads</strong>
+</dt> <dd><p>Return a list of all the live thread objects. A new list is returned by each invocation. </p></dd>
+</dl> <dl> <dt id="main-thread">Variable: <strong>main-thread</strong>
+</dt> <dd><p>This variable keeps the main thread Emacs is running, or <code>nil</code> if Emacs is compiled without thread support. </p></dd>
+</dl> <p>When code run by a thread signals an error that is unhandled, the thread exits. Other threads can access the error form which caused the thread to exit using the following function. </p> <dl> <dt id="thread-last-error">Function: <strong>thread-last-error</strong> <em>&amp;optional cleanup</em>
+</dt> <dd><p>This function returns the last error form recorded when a thread exited due to an error. Each thread that exits abnormally overwrites the form stored by the previous thread’s error with a new value, so only the last one can be accessed. If <var>cleanup</var> is non-<code>nil</code>, the stored form is reset to <code>nil</code>. </p></dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 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/Basic-Thread-Functions.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Basic-Thread-Functions.html</a>
+ </p>
+</div>