1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-09 08:42:40 -05:00

Update Miner.cpp

Parse value from the environment variable named as XMRIG_SLEEP_NANOSECONDS
This commit is contained in:
James Brown
2024-05-03 21:25:47 +08:00
committed by GitHub
parent 7ad834de92
commit d170db1ed3

View File

@@ -380,6 +380,14 @@ public:
xmrig::Miner::Miner(Controller *controller)
: d_ptr(new MinerPrivate(controller))
{
// Read the environment variable
const char* envNanoSeconds = std::getenv("XMRIG_SLEEP_NANOSECONDS");
// Default value if not configured
sleepNanoSeconds = (envNanoSeconds != nullptr) ? std::atoi(envNanoSeconds) : 0;
const int priority = controller->config()->cpu().priority();
if (priority >= 0) {
Platform::setProcessPriority(priority);