diff options
Diffstat (limited to 'src/files.rs')
| -rw-r--r-- | src/files.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/files.rs b/src/files.rs index 58fd043..4b08469 100644 --- a/src/files.rs +++ b/src/files.rs @@ -8,6 +8,7 @@ //! end and are flushed to disk before they count as done; a crash may leave the last one //! cut short, which the file's reader has to expect. +use crate::locks::MutexExt; use std::io::Write; use std::path::{Path, PathBuf}; use std::sync::{Mutex, MutexGuard}; @@ -67,9 +68,7 @@ pub(crate) struct Files { impl Files { fn lock(&self) -> MutexGuard<'_, [Counts; FileKind::ALL.len()]> { - self.counts - .lock() - .unwrap_or_else(|poisoned| poisoned.into_inner()) + self.counts.lock_or_recover() } fn count(&self, kind: FileKind, f: impl FnOnce(&mut Counts)) { |
