diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-04-25 14:39:11 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-04-25 15:12:37 +0100 |
commit | e208de9d259cb50c19d1f2a5086fd8301ac71781 (patch) | |
tree | 912ef8a2c029b81fb81dabb3c3faecd2b588eb4c /lisp/emacs-lisp | |
parent | e527d1ab285e9a6611dc23ea8eae9ae9d8e163bb (diff) | |
download | emacs-e208de9d259cb50c19d1f2a5086fd8301ac71781.tar.gz emacs-e208de9d259cb50c19d1f2a5086fd8301ac71781.tar.bz2 emacs-e208de9d259cb50c19d1f2a5086fd8301ac71781.zip |
Store ongoing compilations processes as hash table.
* lisp/emacs-lisp/comp.el (comp-async-processes): Rename as
`comp-async-compilations'.
(comp-async-runnings): Make use as `comp-async-compilations'.
(comp-run-async-workers): Likewise.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/comp.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 1693e06018a..1369dd115dd 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2146,16 +2146,21 @@ Prepare every function for final compilation and drive the C back-end." (defvar comp-files-queue () "List of Elisp files to be compiled.") -(defvar comp-async-processes () - "List of running async compilation processes.") +(defvar comp-async-compilations (make-hash-table :test #'equal) + "Hash table file-name -> async compilation process.") (defun comp-async-runnings () "Return the number of async compilations currently running. This function has the side effect of cleaning-up finished -processes from `comp-async-processes'" - (setf comp-async-processes - (cl-delete-if-not #'process-live-p comp-async-processes)) - (length comp-async-processes)) +processes from `comp-async-compilations'" + (cl-loop + for file-name in (cl-loop + for file-name being each hash-key of comp-async-compilations + for prc = (gethash file-name comp-async-compilations) + unless (process-live-p prc) + collect file-name) + do (remhash file-name comp-async-compilations)) + (hash-table-count comp-async-compilations)) (let (num-cpus) (defun comp-effective-async-max-jobs () @@ -2213,7 +2218,7 @@ display a message." (comp-output-filename source-file1) (eq load1 'late))) (comp-run-async-workers))))) - (push process comp-async-processes)) + (puthash source-file process comp-async-compilations)) when (>= (comp-async-runnings) (comp-effective-async-max-jobs)) do (cl-return))) ;; No files left to compile and all processes finished. |