mirror of
https://github.com/anrieff/libcpuid
synced 2025-02-02 20:14:07 +00:00
This would likely fix #172 (cpuid_tool.exe v0.6.0 doesn't work on my PC)
This commit is contained in:
parent
f8f73a2eae
commit
1a3785d03f
1 changed files with 3 additions and 0 deletions
|
@ -194,6 +194,7 @@ static bool set_cpu_affinity(logical_cpu_t logical_cpu)
|
||||||
int total_processors = 0;
|
int total_processors = 0;
|
||||||
int group = 0;
|
int group = 0;
|
||||||
int number = 0;
|
int number = 0;
|
||||||
|
int found = 0;
|
||||||
HANDLE thread = GetCurrentThread();
|
HANDLE thread = GetCurrentThread();
|
||||||
GROUP_AFFINITY groupAffinity;
|
GROUP_AFFINITY groupAffinity;
|
||||||
|
|
||||||
|
@ -202,10 +203,12 @@ static bool set_cpu_affinity(logical_cpu_t logical_cpu)
|
||||||
if (total_processors + processors > logical_cpu) {
|
if (total_processors + processors > logical_cpu) {
|
||||||
group = i;
|
group = i;
|
||||||
number = logical_cpu - total_processors;
|
number = logical_cpu - total_processors;
|
||||||
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
total_processors += processors;
|
total_processors += processors;
|
||||||
}
|
}
|
||||||
|
if (!found) return 0; // logical CPU # too large, does not exist
|
||||||
|
|
||||||
memset(&groupAffinity, 0, sizeof(groupAffinity));
|
memset(&groupAffinity, 0, sizeof(groupAffinity));
|
||||||
groupAffinity.Group = (WORD) group;
|
groupAffinity.Group = (WORD) group;
|
||||||
|
|
Loading…
Add table
Reference in a new issue