mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
removed scoped threads, cleanup
This commit is contained in:
parent
f83c0166be
commit
c3f30ae4f0
4 changed files with 69 additions and 74 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -578,7 +578,6 @@ dependencies = [
|
|||
"cfg",
|
||||
"cov-mark",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-utils",
|
||||
"dot",
|
||||
"either",
|
||||
"expect-test",
|
||||
|
|
|
@ -12,7 +12,6 @@ doctest = false
|
|||
[dependencies]
|
||||
cov-mark = "2.0.0-pre.1"
|
||||
crossbeam-channel = "0.5.0"
|
||||
crossbeam-utils = "0.8.5"
|
||||
either = "1.5.3"
|
||||
itertools = "0.10.0"
|
||||
tracing = "0.1"
|
||||
|
|
|
@ -8,7 +8,7 @@ use hir::db::DefDatabase;
|
|||
use ide_db::{
|
||||
base_db::{
|
||||
salsa::{Database, ParallelDatabase, Snapshot},
|
||||
CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt,
|
||||
Cancelled, CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt,
|
||||
},
|
||||
FxIndexMap,
|
||||
};
|
||||
|
@ -54,7 +54,6 @@ pub(crate) fn parallel_prime_caches(
|
|||
builder.build()
|
||||
};
|
||||
|
||||
crossbeam_utils::thread::scope(move |s| {
|
||||
let (work_sender, work_receiver) = crossbeam_channel::unbounded();
|
||||
let (progress_sender, progress_receiver) = crossbeam_channel::unbounded();
|
||||
|
||||
|
@ -80,10 +79,10 @@ pub(crate) fn parallel_prime_caches(
|
|||
for _ in 0..num_worker_threads {
|
||||
let worker = prime_caches_worker.clone();
|
||||
let db = db.snapshot();
|
||||
s.spawn(move |_| worker(db));
|
||||
std::thread::spawn(move || Cancelled::catch(|| worker(db)));
|
||||
}
|
||||
|
||||
let crates_total = crates_to_prime.len();
|
||||
let crates_total = crates_to_prime.pending();
|
||||
let mut crates_done = 0;
|
||||
|
||||
// an index map is used to preserve ordering so we can sort the progress report in order of
|
||||
|
@ -130,8 +129,6 @@ pub(crate) fn parallel_prime_caches(
|
|||
|
||||
cb(progress);
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn compute_crates_to_prime(db: &RootDatabase, graph: &CrateGraph) -> FxHashSet<CrateId> {
|
||||
|
|
|
@ -56,12 +56,12 @@ where
|
|||
TopologicSortIterBuilder::new()
|
||||
}
|
||||
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
pub(crate) fn pending(&self) -> usize {
|
||||
self.nodes.len()
|
||||
}
|
||||
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
self.nodes.len() == 0 && self.ready.len() == 0
|
||||
}
|
||||
|
||||
pub(crate) fn mark_done(&mut self, item: T) {
|
||||
|
|
Loading…
Reference in a new issue