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.
Create a new thread of execution which invokes function. When function returns, the thread exits.
The new thread is created with no local variable bindings in effect. The new thread's current buffer is inherited from the current thread.
name 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 name is provided, it must be a string.
This function returns the new thread.
This function returns
t
if object represents an Emacs thread,nil
otherwise.
Block until thread exits, or until the current thread is signaled. If thread has already exited, this returns immediately.
Like
signal
(see Signaling Errors), but the signal is delivered in the thread thread. If thread is the current thread, then this just callssignal
immediately. Otherwise, thread will receive the signal as soon as it becomes current. If thread was blocked by a call tomutex-lock
,condition-wait
, orthread-join
;thread-signal
will unblock it.
Return
t
if thread is alive, ornil
if it is not. A thread is alive as long as its function is still executing.
Return the object that thread is waiting on. This function is primarily intended for debugging, and is given a “double hyphen” name to indicate that.
If thread is blocked in
thread-join
, this returns the thread for which it is waiting.If thread is blocked in
mutex-lock
, this returns the mutex.If thread is blocked in
condition-wait
, this returns the condition variable.Otherwise, this returns
nil
.
Return a list of all the live thread objects. A new list is returned by each invocation.
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.