Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion external/Catch2
Submodule Catch2 updated 175 files
12 changes: 12 additions & 0 deletions src/ke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ usersim_set_current_thread_affinity(const GROUP_AFFINITY* new_affinity, GROUP_AF
bool result;
if (memcmp(new_affinity, &_usersim_group_affinity_cache, sizeof(*new_affinity)) == 0) {
result = true;
} else if (new_affinity->Mask == 0) {
// Mask=0 means "no affinity override". We can't pass Mask=0 to
// SetThreadGroupAffinity (it requires at least one processor bit),
// so restore the thread to the process-default affinity instead.
DWORD_PTR process_mask = 0;
DWORD_PTR system_mask = 0;
if (GetProcessAffinityMask(GetCurrentProcess(), &process_mask, &system_mask) && process_mask != 0) {
GROUP_AFFINITY default_affinity = {};
default_affinity.Mask = process_mask;
SetThreadGroupAffinity(GetCurrentThread(), &default_affinity, nullptr);
}
result = true;
} else {
result = SetThreadGroupAffinity(GetCurrentThread(), new_affinity, old_affinity);
}
Expand Down
Loading