Skip to content

Commit

Permalink
Fix cpu count on Windows
Browse files Browse the repository at this point in the history
We cannot choose between OSes using macros,
because the binaries built on one system must
work on another.

Closes #77.
  • Loading branch information
gaborcsardi committed Aug 10, 2020
1 parent 7ce8397 commit 6c93607
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
12 changes: 0 additions & 12 deletions src/api-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,17 +586,6 @@ SEXP ps__boot_time() {
* Return the number of logical, active CPUs. Return 0 if undetermined.
* See discussion at: https://bugs.python.org/issue33166#msg314631
*/
#if (_WIN32_WINNT < 0x0601) // < Windows 7 (namely Vista and XP)

SEXP ps__cpu_count_logical() {
return ScalarInteger(NA_INTEGER);
}

SEXP ps__cpu_count_physical() {
return ScalarInteger(NA_INTEGER);
}

#else // Windows >= 7

unsigned int ps__get_num_cpus(int fail_on_err) {
unsigned int ncpus = 0;
Expand Down Expand Up @@ -721,7 +710,6 @@ SEXP ps__cpu_count_physical() {
return ScalarInteger(NA_INTEGER);
}
}
#endif

SEXP ps__kill_if_env(SEXP marker, SEXP after, SEXP pid, SEXP sig) {
const char *cmarker = CHAR(STRING_ELT(marker, 0));
Expand Down
1 change: 1 addition & 0 deletions src/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <stdlib.h>

#include "windows.h"

/*
* ============================================================================
* Utilities
Expand Down

0 comments on commit 6c93607

Please sign in to comment.