summaryrefslogtreecommitdiff
path: root/src/w32.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-10-11 15:56:31 +0300
committerEli Zaretskii <eliz@gnu.org>2021-10-11 15:56:31 +0300
commit1a1b206a8b33dc597fe2153a59fa30baacf1dcc8 (patch)
tree1eb9391ef27fbdbb0fabc83ba3eadd17d1683eb3 /src/w32.c
parent7cb463792334d6f59cdfc89165bac2d7783e3913 (diff)
downloademacs-1a1b206a8b33dc597fe2153a59fa30baacf1dcc8.tar.gz
emacs-1a1b206a8b33dc597fe2153a59fa30baacf1dcc8.tar.bz2
emacs-1a1b206a8b33dc597fe2153a59fa30baacf1dcc8.zip
Adapt the recent 'num_processors' change to MS-Windows
* nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_nproc): Omit nproc. * src/w32.c (num_processors): New function. * src/w32proc.c (Fw32_get_nproc): Remove.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/w32.c b/src/w32.c
index 0eb69d4b1d1..9fe698d28d7 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -39,6 +39,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <sys/time.h>
#include <sys/utime.h>
#include <math.h>
+#include <nproc.h>
/* Include (most) CRT headers *before* ms-w32.h. */
#include <ms-w32.h>
@@ -1962,6 +1963,16 @@ w32_get_nproc (void)
return num_of_processors;
}
+/* Emulate Gnulib's 'num_processors'. We cannot use the Gnulib
+ version because it unconditionally calls APIs that aren't available
+ on old MS-Windows versions. */
+unsigned long
+num_processors (enum nproc_query query)
+{
+ /* We ignore QUERY. */
+ return w32_get_nproc ();
+}
+
static void
sample_system_load (ULONGLONG *idle, ULONGLONG *kernel, ULONGLONG *user)
{