mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-10 22:29:09 -07:00
vecs: init
This commit is contained in:
@@ -49,17 +49,8 @@ where
|
||||
}
|
||||
|
||||
fn safe_truncate_if_needed(&mut self, index: I, exit: &Exit) -> Result<()> {
|
||||
if exit.triggered() {
|
||||
return Ok(());
|
||||
}
|
||||
let blocked = exit.blocked();
|
||||
if !blocked {
|
||||
exit.block();
|
||||
}
|
||||
let _lock = exit.lock();
|
||||
self.0.truncate_if_needed(index)?;
|
||||
if !blocked {
|
||||
exit.release();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -85,17 +76,8 @@ where
|
||||
}
|
||||
|
||||
pub fn safe_flush(&mut self, exit: &Exit) -> Result<()> {
|
||||
if exit.triggered() {
|
||||
return Ok(());
|
||||
}
|
||||
let blocked = exit.blocked();
|
||||
if !blocked {
|
||||
exit.block();
|
||||
}
|
||||
let _lock = exit.lock();
|
||||
self.0.flush()?;
|
||||
if !blocked {
|
||||
exit.release();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user