[thin_check (rust)] remove spurious mutex.

This commit is contained in:
Joe Thornber 2020-07-30 09:59:02 +01:00
parent 8146fba9d2
commit f7623e6264

View File

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