summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/cpu
diff options
context:
space:
mode:
authorpsychocrypt <psychocryptHPC@gmail.com>2018-01-13 21:23:59 +0100
committerpsychocrypt <psychocryptHPC@gmail.com>2018-01-13 21:23:59 +0100
commit6e59483f82edd09a8f90751d832e7c2794e42c67 (patch)
tree25842fb56268a616bfd77dbaeb08b5410dc812db /xmrstak/backend/cpu
parent815246741c9e918b37231166f3a1d5e2d034c8e8 (diff)
downloadxmr-stak-6e59483f82edd09a8f90751d832e7c2794e42c67.zip
xmr-stak-6e59483f82edd09a8f90751d832e7c2794e42c67.tar.gz
fix set affinity for windows
Ignore any affinity >=64 and throw a warning.
Diffstat (limited to 'xmrstak/backend/cpu')
-rw-r--r--xmrstak/backend/cpu/minethd.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index 48425e5..f30d1fe 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -73,7 +73,16 @@ namespace cpu
bool minethd::thd_setaffinity(std::thread::native_handle_type h, uint64_t cpu_id)
{
#if defined(_WIN32)
- return SetThreadAffinityMask(h, 1ULL << cpu_id) != 0;
+ // we can only pin up to 64 threads
+ if(cpu_id < 64)
+ {
+ return SetThreadAffinityMask(h, 1ULL << cpu_id) != 0;
+ }
+ else
+ {
+ printer::inst()->print_msg(L0, "WARNING: Windows supports only affinity up to 63.");
+ return false;
+ }
#elif defined(__APPLE__)
thread_port_t mach_thread;
thread_affinity_policy_data_t policy = { static_cast<integer_t>(cpu_id) };
OpenPOWER on IntegriCloud