fix(mining): make XmrigManager's thread count atomic
The requested thread count is written by generateConfig() on the mining-control thread and read on the UI thread (the thread-grid sync under idle thread scaling, the pool auto-balance restart) without any synchronisation. The write also stored the unclamped count first and clamped it afterwards, so a reader could see more threads than cores. It is now an atomic, set by one store of the clamped value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -173,7 +173,7 @@ private:
|
||||
// xmrig HTTP API credentials (random per session)
|
||||
int api_port_ = 0;
|
||||
std::string api_token_;
|
||||
int threads_ = 0; // Thread count for mining
|
||||
std::atomic<int> threads_{0}; // Thread count for mining (written on the mining-control thread, read by the UI)
|
||||
std::string pool_host_; // Pool hostname for stats API
|
||||
PoolStats stats_;
|
||||
mutable std::mutex stats_mutex_;
|
||||
|
||||
Reference in New Issue
Block a user