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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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);