From 7b7dcb5a77061cb69d368de263a02b5ad26fbf51 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 26 Oct 2026 04:20:52 +0100 Subject: unify lock logic --- src/files.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/files.rs') 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)) { -- cgit v1.3.1