From f17b80c61e6a8a44bebdb60dfac6bff4b8989860 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 20 Jan 2016 11:04:28 -0500 Subject: [PATCH] Use stdlib 'hardware_concurrency' to get logical processor count This has the benifit of being multiplatform. --- src/xenia/base/threading.cc | 8 ++++++++ src/xenia/base/threading_win.cc | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/xenia/base/threading.cc b/src/xenia/base/threading.cc index 40d89a6c0..98c91715e 100644 --- a/src/xenia/base/threading.cc +++ b/src/xenia/base/threading.cc @@ -12,6 +12,14 @@ namespace xe { namespace threading { +uint32_t logical_processor_count() { + static uint32_t value = 0; + if (!value) { + value = std::thread::hardware_concurrency(); + } + return value; +} + thread_local uint32_t current_thread_id_ = UINT_MAX; uint32_t current_thread_id() { diff --git a/src/xenia/base/threading_win.cc b/src/xenia/base/threading_win.cc index d36ee76e1..4381db8cb 100644 --- a/src/xenia/base/threading_win.cc +++ b/src/xenia/base/threading_win.cc @@ -16,16 +16,6 @@ namespace xe { namespace threading { -uint32_t logical_processor_count() { - static uint32_t value = 0; - if (!value) { - SYSTEM_INFO system_info; - GetSystemInfo(&system_info); - value = system_info.dwNumberOfProcessors; - } - return value; -} - void EnableAffinityConfiguration() { HANDLE process_handle = GetCurrentProcess(); DWORD_PTR process_affinity_mask;