diff options
author | Nicolás Bértolo <nicolasbertolo@gmail.com> | 2020-05-13 16:22:17 -0300 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-05-23 09:36:52 +0100 |
commit | d59607b68592fa709bd8466a3ac7300d280df83a (patch) | |
tree | 2046c972d4d6e65a7056db8bc79990542f508d4c /lisp | |
parent | 60b326ef112b6196cccf8bf9508df9e6622285cb (diff) | |
download | emacs-d59607b68592fa709bd8466a3ac7300d280df83a.tar.gz emacs-d59607b68592fa709bd8466a3ac7300d280df83a.tar.bz2 emacs-d59607b68592fa709bd8466a3ac7300d280df83a.zip |
* Windows: Use NUMBER_OF_PROCESSORS environment variable.
* lisp/emacs-lisp/comp.el (comp-effective-async-max-jobs): Use
NUMBER_OF_PROCESSORS environment variable if system is Windows NT,
"nproc" if it is in PATH or a default of 1.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/comp.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index e5d3be6eed0..6c152136fb5 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2302,9 +2302,14 @@ processes from `comp-async-compilations'" (if (zerop comp-async-jobs-number) (or comp-num-cpus (setf comp-num-cpus - ;; Half of the CPUs or at least one. - ;; FIXME portable? - (max 1 (/ (string-to-number (shell-command-to-string "nproc")) + ;; FIXME: we already have a function to determine + ;; the number of processors, see get_native_system_info in w32.c. + ;; The result needs to be exported to Lisp. + (max 1 (/ (cond ((eq 'windows-nt system-type) + (string-to-number (getenv "NUMBER_OF_PROCESSORS"))) + ((executable-find "nproc") + (string-to-number (shell-command-to-string "nproc"))) + (t 1)) 2)))) comp-async-jobs-number)) |