Switching a few types to their platform-agnostic versions.
This commit is contained in:
@@ -48,6 +48,10 @@ class Fence {
|
||||
// Returns the total number of logical processors in the host system.
|
||||
uint32_t logical_processor_count();
|
||||
|
||||
// Enables the current process to set thread affinity.
|
||||
// Must be called at startup before attempting to set thread affinity.
|
||||
void EnableAffinityConfiguration();
|
||||
|
||||
// Gets a stable thread-specific ID, but may not be. Use for informative
|
||||
// purposes only.
|
||||
uint32_t current_thread_id();
|
||||
|
||||
@@ -26,6 +26,15 @@ uint32_t logical_processor_count() {
|
||||
return value;
|
||||
}
|
||||
|
||||
void EnableAffinityConfiguration() {
|
||||
HANDLE process_handle = GetCurrentProcess();
|
||||
DWORD_PTR process_affinity_mask;
|
||||
DWORD_PTR system_affinity_mask;
|
||||
GetProcessAffinityMask(process_handle, &process_affinity_mask,
|
||||
&system_affinity_mask);
|
||||
SetProcessAffinityMask(process_handle, system_affinity_mask);
|
||||
}
|
||||
|
||||
uint32_t current_thread_id() {
|
||||
return static_cast<uint32_t>(GetCurrentThreadId());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user