Use stdlib 'hardware_concurrency' to get logical processor count

This has the benifit of being multiplatform.
This commit is contained in:
sephiroth99 2016-01-20 11:04:28 -05:00
parent 5d9a4b6830
commit f17b80c61e
2 changed files with 8 additions and 10 deletions

View File

@ -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() {

View File

@ -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;