Use stdlib 'hardware_concurrency' to get logical processor count
This has the benifit of being multiplatform.
This commit is contained in:
parent
5d9a4b6830
commit
f17b80c61e
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue