make it a config

This commit is contained in:
Jake Heinz
2022-01-15 02:47:47 +00:00
parent bcc99091f3
commit 25f67b6939
6 changed files with 38 additions and 8 deletions

View File

@@ -505,17 +505,16 @@ impl GlobalState {
self.fetch_build_data();
}
if self.prime_caches_queue.should_start_op() {
let num_worker_threads = self.config.prime_caches_num_threads();
self.task_pool.handle.spawn_with_sender({
let analysis = self.snapshot().analysis;
move |sender| {
sender.send(Task::PrimeCaches(PrimeCachesProgress::Begin)).unwrap();
let res = analysis.parallel_prime_caches(
num_cpus::get_physical().try_into().unwrap_or(u8::MAX),
|progress| {
let report = PrimeCachesProgress::Report(progress);
sender.send(Task::PrimeCaches(report)).unwrap();
},
);
let res = analysis.parallel_prime_caches(num_worker_threads, |progress| {
let report = PrimeCachesProgress::Report(progress);
sender.send(Task::PrimeCaches(report)).unwrap();
});
sender
.send(Task::PrimeCaches(PrimeCachesProgress::End {
cancelled: res.is_err(),