Expand description
Multi-threaded elisp support.
The go function spawns a new thread to evaluate an expression and returns
a channel receiver that will eventually contain the result.
§Result Format
- On success: The receiver contains the evaluation result
- On error: The receiver contains
('thread-errored . "error message")
§Usage from Elisp
;; Successful evaluation
(let ((receiver (go (+ 1 2))))
(channel-recv receiver)) ; Returns 3
;; Error handling with pcase
(let ((receiver (go (undefined-function))))
(pcase (channel-recv receiver)
(`(thread-errored . ,msg)
(message "Thread error: %s" msg))
(result
(message "Got result: %s" result))))
;; Discard result (fire and forget)
(go (message "Background task"))Functions§
- go 🔒
- go_
internal 🔒