Implement hardware_concurrency on Windows.
diff --git a/asio/include/asio/detail/impl/win_thread.ipp b/asio/include/asio/detail/impl/win_thread.ipp index 554f9f6..6996f40 100644 --- a/asio/include/asio/detail/impl/win_thread.ipp +++ b/asio/include/asio/detail/impl/win_thread.ipp
@@ -53,6 +53,13 @@ } } +std::size_t win_thread::hardware_concurrency() +{ + SYSTEM_INFO system_info; + ::GetSystemInfo(&system_info); + return system_info.dwNumberOfProcessors; +} + void win_thread::start_thread(func_base* arg, unsigned int stack_size) { ::HANDLE entry_event = 0;
diff --git a/asio/include/asio/detail/win_thread.hpp b/asio/include/asio/detail/win_thread.hpp index 0f8abc4..38f60a7 100644 --- a/asio/include/asio/detail/win_thread.hpp +++ b/asio/include/asio/detail/win_thread.hpp
@@ -19,6 +19,7 @@ #if defined(ASIO_WINDOWS) && !defined(UNDER_CE) +#include <cstddef> #include "asio/detail/noncopyable.hpp" #include "asio/detail/socket_types.hpp" @@ -76,6 +77,9 @@ // Wait for the thread to exit. ASIO_DECL void join(); + // Get number of CPUs. + ASIO_DECL static std::size_t hardware_concurrency(); + private: friend ASIO_DECL unsigned int __stdcall win_thread_function(void* arg);