Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Threema/domain/libthreema/lib/src/utils/     Datei vom 25.3.2026 mit Größe 620 B image not shown  

Quelle  sync.rs   Sprache: unbekannt

 
Spracherkennung für: .rs vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

//! Sync-related utilities.
use std::sync::{Mutex, MutexGuard, PoisonError};

/// Extension for [`Mutex`] to ignore and disregard any poison introduced by a thread panicking
/// while holding the lock.
pub(crate) trait MutexIgnorePoison {
    type T;

    /// Acquires a mutex, blocking the current thread until it is able to do so, ignoring any mutex
    /// poison.
    fn lock_ignore_poison(&self) -> MutexGuard<'_, Self::T>;
}

impl<T> MutexIgnorePoison for Mutex<T> {
    type T = T;

    fn lock_ignore_poison(&self) -> MutexGuard<'_, Self::T> {
        self.lock().unwrap_or_else(PoisonError::into_inner)
    }
}

[Dauer der Verarbeitung: 0.17 Sekunden, vorverarbeitet 2026-04-27]