diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-07-02 17:53:48 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-07-02 17:53:48 +0000 |
commit | ca69356d52bd1f1abfd57686be5fb13648fb9e46 (patch) | |
tree | 4a94351f7e7ae076df97538d3943e651b1a3e5fc /libcxx/src/thread.cpp | |
parent | 95f501284a0d0ba676e232475ec39b2d4e8900c7 (diff) | |
download | bcm5719-llvm-ca69356d52bd1f1abfd57686be5fb13648fb9e46.tar.gz bcm5719-llvm-ca69356d52bd1f1abfd57686be5fb13648fb9e46.zip |
Windows support in thread::hardware_concurrency.
llvm-svn: 185451
Diffstat (limited to 'libcxx/src/thread.cpp')
-rw-r--r-- | libcxx/src/thread.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp index 5bf74140d50..1fd8bb047c8 100644 --- a/libcxx/src/thread.cpp +++ b/libcxx/src/thread.cpp @@ -23,6 +23,9 @@ #if defined(__NetBSD__) #pragma weak pthread_create // Do not create libpthread dependency #endif +#if defined(_WIN32) +#include <windows.h> +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -79,6 +82,10 @@ thread::hardware_concurrency() _NOEXCEPT if (result < 0) return 0; return static_cast<unsigned>(result); +#elif defined(_WIN32) + SYSTEM_INFO info; + GetSystemInfo(&info); + return info.dwNumberOfProcessors; #else // defined(CTL_HW) && defined(HW_NCPU) // TODO: grovel through /proc or check cpuid on x86 and similar // instructions on other architectures. |