Skip to content

Commit 6564a8b

Browse files
committed
Use std::thread::hardware_concurrency instead of our own solution
1 parent 2a13d4f commit 6564a8b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

stdlib/public/stubs/Stubs.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static long double swift_strtold_l(const char *nptr,
6464
#include <xlocale.h>
6565
#endif
6666
#include <limits>
67+
#include <thread>
6768
#include "llvm/ADT/StringExtras.h"
6869
#include "llvm/Support/Compiler.h"
6970
#include "swift/Runtime/Debug.h"
@@ -537,11 +538,5 @@ int swift::_swift_stdlib_putc_stderr(int C) {
537538
}
538539

539540
size_t swift::_swift_stdlib_getHardwareConcurrency() {
540-
#if defined(_WIN32)
541-
SYSTEM_INFO SystemInfo;
542-
GetSystemInfo(&SystemInfo);
543-
return SystemInfo.dwNumberOfProcessors;
544-
#else
545-
return sysconf(_SC_NPROCESSORS_ONLN);
546-
#endif
541+
return std::thread::hardware_concurrency();
547542
}

0 commit comments

Comments
 (0)