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
+6 -1
View File
@@ -157,7 +157,12 @@ pub fn create_key(context: Arc<Mutex<Context>>) {
let mining = Arc::new(AtomicBool::new(true));
let miners_count = Arc::new(AtomicUsize::new(0));
{ context.lock().unwrap().bus.post(Event::KeyGeneratorStarted); }
for _cpu in 0..num_cpus::get() {
let threads = context.lock().unwrap().settings.mining.threads;
let threads = match threads {
0 => num_cpus::get(),
_ => threads
};
for _cpu in 0..threads {
let context = Arc::clone(&context);
let mining = mining.clone();
let miners_count = miners_count.clone();