impl Drop for Store
This commit is contained in:
parent
92f03edf2b
commit
d23e2f920d
1 changed files with 14 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::ops::Drop;
|
||||
use std::path::PathBuf;
|
||||
use std::result::Result as RResult;
|
||||
use std::sync::Arc;
|
||||
|
@ -43,3 +44,16 @@ impl Store {
|
|||
|
||||
}
|
||||
|
||||
impl Drop for Store {
|
||||
|
||||
/**
|
||||
* Unlock all files on drop
|
||||
*
|
||||
* TODO: Error message when file cannot be unlocked?
|
||||
*/
|
||||
fn drop(&mut self) {
|
||||
self.cache.iter().map(|f| f.unlock());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue