Added mining threads count option.

This commit is contained in:
Revertron
2021-03-29 11:10:48 +02:00
parent 5aab83613e
commit 4e0b0b3d1c
8 changed files with 53 additions and 11 deletions
+7 -2
View File
@@ -142,8 +142,13 @@ impl Miner {
let thread_spawn_interval = Duration::from_millis(10);
let live_threads = Arc::new(AtomicU32::new(0u32));
let cpus = num_cpus::get();
debug!("Starting {} threads for mining", cpus);
for _cpu in 0..cpus {
let threads = context.lock().unwrap().settings.mining.threads;
let threads = match threads {
0 => cpus,
_ => threads
};
debug!("Starting {} threads for mining", threads);
for _cpu in 0..threads {
let context = Arc::clone(&context);
let job = job.clone();
let mining = Arc::clone(&mining);