diff --git a/src/thin/check.rs b/src/thin/check.rs index 471fad7..58c5ee3 100644 --- a/src/thin/check.rs +++ b/src/thin/check.rs @@ -146,7 +146,7 @@ trait NodeVisitor { #[derive(Clone)] struct BTreeWalker { - engine: Arc>, + engine: Arc, seen: Arc>, } @@ -154,7 +154,7 @@ impl BTreeWalker { fn new(engine: AsyncIoEngine) -> BTreeWalker { let nr_blocks = engine.get_nr_blocks() as usize; let r: BTreeWalker = BTreeWalker { - engine: Arc::new(Mutex::new(engine)), + engine: Arc::new(engine), seen: Arc::new(Mutex::new(FixedBitSet::with_capacity(nr_blocks))), }; r @@ -174,9 +174,7 @@ impl BTreeWalker { } drop(seen); - let mut engine = self.engine.lock().unwrap(); - engine.read_many(&mut blocks)?; - drop(engine); + self.engine.read_many(&mut blocks)?; for b in blocks { self.walk_node(visitor, &b)?; @@ -263,9 +261,7 @@ impl NodeVisitor for TopLevelVisitor { } drop(seen); - let mut engine = w.engine.lock().unwrap(); - engine.read_many(&mut blocks)?; - drop(engine); + w.engine.read_many(&mut blocks)?; // FIXME: with a thread pool we need to return errors another way. let nr_workers = 16;