Skip to content
Snippets Groups Projects
Commit b5a7e4eb authored by psychocrypt's avatar psychocrypt
Browse files

check if affinity must be set

- check if affinity vale before calling `thd_setaffinity`
parent b685c90f
No related branches found
No related tags found
No related merge requests found
......@@ -64,8 +64,9 @@ minethd::minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::th
order_guard.wait();
if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity))
printer::inst()->print_msg(L1, "WARNING setting affinity failed.");
if(affinity >= 0) //-1 means no affinity
if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity))
printer::inst()->print_msg(L1, "WARNING setting affinity failed.");
}
extern "C" {
......
......@@ -110,8 +110,9 @@ minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefet
order_guard.wait();
if(!thd_setaffinity(oWorkThd.native_handle(), affinity))
printer::inst()->print_msg(L1, "WARNING setting affinity failed.");
if(affinity >= 0) //-1 means no affinity
if(!thd_setaffinity(oWorkThd.native_handle(), affinity))
printer::inst()->print_msg(L1, "WARNING setting affinity failed.");
}
cryptonight_ctx* minethd::minethd_alloc_ctx()
......@@ -270,7 +271,6 @@ std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work
else
printer::inst()->print_msg(L1, "Starting %s thread, no affinity.", cfg.bDoubleMode ? "double" : "single");
// \todo need thread offset
minethd* thd = new minethd(pWork, i + threadOffset, cfg.bDoubleMode, cfg.bNoPrefetch, cfg.iCpuAff);
pvThreads.push_back(thd);
}
......
......@@ -82,8 +82,9 @@ minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg)
order_guard.wait();
if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity))
printer::inst()->print_msg(L1, "WARNING setting affinity failed.");
if(affinity >= 0) //-1 means no affinity
if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity))
printer::inst()->print_msg(L1, "WARNING setting affinity failed.");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment