From 619f66f423c76d94b2bca728f9c22b536e909108 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 7 Mar 2021 15:32:55 +0200 Subject: Use MS-Windows system APIs to get number of processors * lisp/emacs-lisp/comp.el: Use 'w32-get-nproc' instead of the environment variable NUMBER_OF_PROCESSORS. * src/w32proc.c (Fw32_get_nproc): New primitive. * src/w32.c (w32_get_nproc): New function. (sample_system_load): Call w32_get_nproc to initialize the number of processors on this system. * src/w32.h (w32_get_nproc): Add prototype. --- lisp/emacs-lisp/comp.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 134b5a28086..70e10644ca8 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -3824,8 +3824,7 @@ processes from `comp-async-compilations'" ;; 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"))) + (w32-get-nproc)) ((executable-find "nproc") (string-to-number (shell-command-to-string "nproc"))) -- cgit v1.2.3