Fixed setThreadAffinity()
Added 1 ms sleep to guarantee thread rescheduling to the correct CPU core before returning.
This commit is contained in:
parent
23a1ae0337
commit
269d12d1be
4 changed files with 18 additions and 5 deletions
|
@ -98,7 +98,9 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
|||
LOG_ERR("Unable to set affinity. Windows supports only affinity up to 63.");
|
||||
}
|
||||
|
||||
return SetThreadAffinityMask(GetCurrentThread(), 1ULL << cpu_id) != 0;
|
||||
const bool result = (SetThreadAffinityMask(GetCurrentThread(), 1ULL << cpu_id) != 0);
|
||||
Sleep(1);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue