Hacker News new | ask | show | jobs
by brlewis 2139 days ago
Then what's the section on "Threads" about in https://www.gnu.org/savannah-checkouts/gnu/emacs/news/NEWS.2... ?

Threads

* New variable 'main-thread' holds Emacs's main thread. This is handy in Lisp programs that run on a non-main thread and want to signal the main thread, e.g., when they encounter an error.

* 'thread-join' now returns the result of the finished thread.

* 'thread-signal' does not propagate errors to the main thread. Instead, error messages are just printed in the main thread.

* 'thread-alive-p' is now obsolete, use 'thread-live-p' instead.

* New command 'list-threads' shows Lisp threads. See the current list of live threads in a tabulated-list buffer which automatically updates. In the buffer, you can use 's q' or 's e' to signal a thread with quit or error respectively, or get a snapshot backtrace with 'b'.

1 comments

These are cooperative threads, not kernel threads which can actually run at the same time. It uses threads for its abstraction as a concurrent task. Ruby and Python also have "Thread" classes which don't make system calls and are just useful as a programming pattern. Maybe one day Emacs (and Python and Ruby) will have real threads, so the idea might be to switch the implementation over to real threads without requiring any client code to be rewritten since it follows the same API as real threads.