1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 03:40:56 -08:00

(native--compile-async): Try and avoid inf-loops (bug#80012)

* lisp/emacs-lisp/comp-run.el (native--compile-async): Call
`comp--run-async-workers` only if we caused the queue to become non-empty.
This commit is contained in:
Stefan Monnier 2025-12-31 13:15:40 -05:00
parent a03419b52c
commit 20e1a57d44

View file

@ -454,6 +454,7 @@ bytecode definition was not changed in the meantime)."
(unless (listp files)
(setf files (list files)))
(let ((added-something nil)
(old-comp-files-queue comp-files-queue)
file-list)
(dolist (file-or-dir files)
(cond ((file-directory-p file-or-dir)
@ -472,6 +473,8 @@ bytecode definition was not changed in the meantime)."
;; compilation, so update `comp-files-queue' to reflect that.
(unless (or (null load)
(eq load (cdr entry)))
;; IIUC, this is a non-destructive version of
;; (setcdr entry load)?
(setf comp-files-queue
(cl-loop for i in comp-files-queue
with old = (car entry)
@ -494,6 +497,9 @@ bytecode definition was not changed in the meantime)."
out-filename)))))))
;; Perhaps nothing passed `native--compile-async-skip-p'?
(when (and added-something
;; If the queue was already non-empty, then we already
;; in the middle of processing the queue.
(null old-comp-files-queue)
;; Don't start if there's one already running.
(zerop (comp--async-runnings)))
(comp--run-async-workers))))