summaryrefslogtreecommitdiff
path: root/src/w32proc.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-03-07 15:32:55 +0200
committerEli Zaretskii <eliz@gnu.org>2021-03-07 15:32:55 +0200
commit619f66f423c76d94b2bca728f9c22b536e909108 (patch)
treeecdea436c993f75d73b325c7552937a223365d80 /src/w32proc.c
parent99638d128ee07fa35525ac47217f68dd518e9175 (diff)
downloademacs-619f66f423c76d94b2bca728f9c22b536e909108.tar.gz
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.
Diffstat (limited to 'src/w32proc.c')
-rw-r--r--src/w32proc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index 2b6cb9c1e1d..a50c87777fa 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3877,6 +3877,14 @@ w32_compare_strings (const char *s1, const char *s2, char *locname,
return val - 2;
}
+DEFUN ("w32-get-nproc", Fw32_get_nproc,
+ Sw32_get_nproc, 0, 0, 0,
+ doc: /* Return the number of system's processor execution units. */)
+ (void)
+{
+ return make_fixnum (w32_get_nproc ());
+}
+
void
syms_of_ntproc (void)
@@ -3911,6 +3919,8 @@ syms_of_ntproc (void)
defsubr (&Sw32_get_keyboard_layout);
defsubr (&Sw32_set_keyboard_layout);
+ defsubr (&Sw32_get_nproc);
+
DEFVAR_LISP ("w32-quote-process-args", Vw32_quote_process_args,
doc: /* Non-nil enables quoting of process arguments to ensure correct parsing.
Because Windows does not directly pass argv arrays to child processes,